2022-06-04 03:13:19 +00:00
|
|
|
import { faBinoculars, faPencil } from "@fortawesome/free-solid-svg-icons"
|
|
|
|
import { useTranslation } from "next-i18next"
|
|
|
|
import { EditingContext } from "../../contexts/editing"
|
|
|
|
import { useDefinedContext } from "../../utils/definedContext"
|
|
|
|
import { FestaIcon } from "../extensions/FestaIcon"
|
|
|
|
|
|
|
|
export function ToolToggleEditing() {
|
|
|
|
const {t} = useTranslation()
|
|
|
|
const [editing, setEditing] = useDefinedContext(EditingContext)
|
|
|
|
|
|
|
|
return (
|
|
|
|
<button
|
|
|
|
aria-label={editing ? t("toggleEditingView") : t("toggleEditingEdit")}
|
|
|
|
onClick={() => setEditing(!editing)}
|
2022-06-05 15:35:35 +00:00
|
|
|
className="square-40"
|
2022-06-04 03:13:19 +00:00
|
|
|
>
|
|
|
|
<FestaIcon icon={editing ? faBinoculars : faPencil}/>
|
|
|
|
</button>
|
|
|
|
)
|
|
|
|
}
|