2022-06-07 10:48:47 +00:00
|
|
|
import { faEye, faEyeSlash } from "@fortawesome/free-solid-svg-icons"
|
|
|
|
import { useTranslation } from "next-i18next"
|
|
|
|
import { useDefinedContext } from "../../utils/definedContext"
|
|
|
|
import { FestaIcon } from "../extensions/FestaIcon"
|
2022-06-09 21:43:38 +00:00
|
|
|
import { PostcardContext, PostcardVisibility } from "../postcard/PostcardContext"
|
2022-06-07 10:48:47 +00:00
|
|
|
|
|
|
|
export function ToolToggleVisible() {
|
2022-06-09 21:43:38 +00:00
|
|
|
const { t } = useTranslation()
|
|
|
|
const { visibility, setVisibility } = useDefinedContext(PostcardContext)
|
2022-06-07 10:48:47 +00:00
|
|
|
|
2022-06-09 21:43:38 +00:00
|
|
|
if (visibility === PostcardVisibility.BACKGROUND) {
|
|
|
|
return (
|
|
|
|
<button
|
|
|
|
aria-label={t("toggleVisibleShow")}
|
|
|
|
onClick={() => setVisibility(PostcardVisibility.FOREGROUND)}
|
|
|
|
className="toolbar-tool"
|
|
|
|
>
|
|
|
|
<FestaIcon icon={faEye} />
|
|
|
|
</button>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return (
|
|
|
|
<button
|
|
|
|
aria-label={t("toggleVisibleHide")}
|
|
|
|
onClick={() => setVisibility(PostcardVisibility.BACKGROUND)}
|
|
|
|
className="toolbar-tool"
|
|
|
|
>
|
|
|
|
<FestaIcon icon={faEyeSlash} />
|
|
|
|
</button>
|
|
|
|
)
|
|
|
|
}
|
2022-06-07 10:48:47 +00:00
|
|
|
}
|