1
Fork 0
mirror of https://github.com/Steffo99/festa.git synced 2024-12-23 07:04:22 +00:00
festa/components/tools/ToolToggleEditing.tsx

20 lines
737 B
TypeScript
Raw Normal View History

2022-06-04 03:13:19 +00:00
import { faBinoculars, faPencil } from "@fortawesome/free-solid-svg-icons"
import { useTranslation } from "next-i18next"
2022-06-08 16:00:39 +00:00
import { EditingContext } from "../editable/EditingContext"
2022-06-04 03:13:19 +00:00
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-07 11:41:26 +00:00
className="toolbar-tool"
2022-06-04 03:13:19 +00:00
>
<FestaIcon icon={editing ? faBinoculars : faPencil}/>
</button>
)
}