forge
Explore
Log in

Don't you dare go Hollow

hezarfen_frontend

Clone
★ 0

0 watching0 forksTypeScript5.5 MiB5fcd955Burak Boduroğlu2 months ago730 commits

fullscreen-toggle.tsx30 lines, 1.0 KiBHistoryRawDownload
1import { Show } from "solid-js";
2import { IconMaximize, IconMinimize } from "@/components/ui/icons";
3import { cn } from "@/lib/cn";
4import { useT } from "@/stores/preferences-context";
5
6/**
7 * Icon button that enters/leaves full screen for a drawing surface. State lives
8 * in the host's `createFullscreen()` (src/lib/fullscreen.ts); this only renders.
9 */
10export function FullscreenToggle(props: { active: boolean; onToggle: () => void; class?: string }) {
11 const t = useT();
12 const label = () => (props.active ? t("draw.exitFullscreen") : t("draw.fullscreen"));
13 return (
14 <button
15 type="button"
16 class={cn(
17 "flex h-9 w-9 items-center justify-center text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
18 props.class,
19 )}
20 title={label()}
21 aria-label={label()}
22 aria-pressed={props.active}
23 onClick={() => props.onToggle()}
24 >
25 <Show when={props.active} fallback={<IconMaximize class="h-5 w-5" />}>
26 <IconMinimize class="h-5 w-5" />
27 </Show>
28 </button>
29 );
30}