1
Fork 0
mirror of https://github.com/Steffo99/festa.git synced 2024-12-23 15:14:23 +00:00
festa/components/tools/ToolToggleVisible.tsx

20 lines
730 B
TypeScript
Raw Normal View History

import { faEye, faEyeSlash } from "@fortawesome/free-solid-svg-icons"
import { useTranslation } from "next-i18next"
import { useDefinedContext } from "../../utils/definedContext"
import { FestaIcon } from "../extensions/FestaIcon"
import { PostcardContext } from "../postcard/PostcardContext"
export function ToolToggleVisible() {
const {t} = useTranslation()
const {visible, setVisible} = useDefinedContext(PostcardContext)
return (
<button
aria-label={visible ? t("toggleVisibleHide") : t("toggleVisibleShow")}
onClick={() => setVisible(!visible)}
2022-06-07 11:41:26 +00:00
className="toolbar-tool"
>
<FestaIcon icon={visible ? faEyeSlash : faEye}/>
</button>
)
}