homeman-deno/islands/Nav.tsx

55 lines
1.5 KiB
TypeScript
Raw Normal View History

2024-01-16 16:45:51 -06:00
// import { JSX } from 'preact'
// import { IS_BROWSER } from '$fresh/runtime.ts'
import { Bars3Outline } from 'preact-heroicons'
import { Clock } from '@homeman/islands/Clock.tsx'
import { Dialog } from '@homeman/components/Dialog.tsx'
import { useSignal } from '@preact/signals'
2024-01-18 14:18:51 -06:00
import { IS_BROWSER } from '$fresh/runtime.ts'
let fireworks: HTMLAudioElement | undefined
if (IS_BROWSER) fireworks = new Audio('/fireworks.mp3')
2024-01-16 16:45:51 -06:00
export function Nav(/* props: {} */) {
const showMenu = useSignal(false)
return (
<>
<Dialog
headerTitle='Main Menu'
show={showMenu.value}
onClose={() => {
showMenu.value = false
}}
>
2024-01-17 15:10:28 -06:00
<section class='flex flex-col text-center p-2 gap-2'>
<a class='p-4 rounded bg-gray-500/20' href='/'>Dashboard</a>
<a class='p-4 rounded bg-gray-500/20' href='/routine'>
Daily Routine
</a>
<a class='p-4 rounded bg-gray-500/20' href='/admin'>Edit Users</a>
2024-01-18 14:18:51 -06:00
<button
class='p-4 bg-gray-500/20 hover:bg-stone-500/20'
onClick={() => IS_BROWSER && fireworks?.play()}
>
Play Sound
</button>
2024-01-17 15:10:28 -06:00
</section>
2024-01-16 16:45:51 -06:00
</Dialog>
<nav class='bg-stone-200 dark:bg-stone-800 flex justify-items-start items-center'>
<button
class='p-4 hover:bg-stone-500/20'
onClick={() => {
showMenu.value = true
}}
>
<Bars3Outline class='h-6 w-6' />
</button>
<a class='p-4 hover:bg-stone-500/20' href='/'>
Flanagan Family
</a>
<Clock class='ml-auto pr-4 text-2xl' />
</nav>
</>
)
}