11import { useSetAtom } from 'jotai' ;
22import type { ReactNode } from 'react' ;
33import { useId , useRef } from 'react' ;
4+ import cs from 'classnames' ;
45import CrossSvg from '../assets/cross.svg' ;
56import HamburgerSvg from '../assets/hamburger.svg' ;
67import {
@@ -24,21 +25,23 @@ export function ExampleLayout(props: ExampleLayoutProps) {
2425
2526 return (
2627 < >
27- < div className = "absolute top-4 left-4 z-50 flex gap-2 text-sm md:hidden" >
28+ < div
29+ className = { cs ( 'absolute top-5 left-5 z-50 flex gap-2 text-sm' , menuShown && 'md:left-84' ) }
30+ >
2831 { ! menuShown && (
2932 < Button onClick = { ( ) => setMenuShown ( true ) } >
3033 < img src = { HamburgerSvg . src } alt = "menu" className = "-m-2 h-6 w-6" />
3134 </ Button >
3235 ) }
3336
3437 < Button onClick = { ( ) => setCodeShown ( ( prev ) => ! prev ) } >
35- { /* Applying the actual label only after the component has been hydrated */ }
36- { codeShown ? 'Preview ' : 'Code' }
38+ < span className = "md:hidden" > { codeShown ? 'Preview' : 'Code' } </ span >
39+ < span className = "hidden md:block" > { codeShown ? 'Hide Code ' : 'Show Code' } </ span >
3740 </ Button >
3841 </ div >
39-
4042 < div className = "box-border flex h-dvh gap-4 bg-tameplum-50 p-4" >
4143 { menuShown && < SideMenu /> }
44+
4245 { props . children }
4346 </ div >
4447 </ >
@@ -57,17 +60,24 @@ function SideMenu() {
5760 const groupByCategoryToggleId = useId ( ) ;
5861
5962 return (
60- < aside className = "absolute inset-0 z-50 box-border flex w-full flex-col bg-white md:static md:w-75 md:rounded-2xl" >
63+ < aside className = "absolute inset-0 z-50 box-border flex w-full flex-col bg-white md:relative md:w-75 md:rounded-2xl" >
6164 < header className = "px-5 py-3" >
6265 < div className = "grid place-items-center" >
6366 < a href = "/TypeGPU" className = "box-border grid h-12 cursor-pointer place-content-center" >
6467 < img className = "w-40" src = "/TypeGPU/typegpu-logo-light.svg" alt = "TypeGPU Logo" />
6568 </ a >
6669 </ div >
67- < div className = "absolute top-5 right-5 md:hidden" >
68- < Button onClick = { ( ) => setMenuShown ( false ) } >
70+ < div className = "absolute top-5 right-5 md:top-2.5 md:right-2.5" >
71+ < button
72+ className = { cs (
73+ 'box-border inline-flex items-center justify-center gap-2 rounded-[6.25rem] px-2.5 py-2.5 text-sm focus:ring-2 focus:ring-gradient-blue' ,
74+ 'bg-white hover:bg-tameplum-20' ,
75+ ) }
76+ type = "button"
77+ onClick = { ( ) => setMenuShown ( false ) }
78+ >
6979 < img src = { CrossSvg . src } alt = "Close menu" className = "h-3 w-3" />
70- </ Button >
80+ </ button >
7181 </ div >
7282 </ header >
7383
0 commit comments