-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Header / Main Nav / SiteDef: cleaned up handling of featured CTA (eg, "Enter App") DrawerMenu improvements: Now in common, as it is configured for our apps (supports logo, opens from the right) closeElement (icon) is passed in. primitives/Sheet (underlying DrawerMenu) now also supports a centerElement, which we now use for an optional logo MobileNav: uses better fonts and colors, reflects siteDef.currentAs, and displays CTA properly Logo: added xs size (for mobile menu impl) TShirtSize, TShirtDimensions, added xs and xl (admin: started to use semver for this module, so calling this 0.3.0)
- Loading branch information
1 parent
8666d61
commit 6ce7a9c
Showing
14 changed files
with
219 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
'use client' | ||
import React, { type PropsWithChildren, type ReactNode } from 'react' | ||
|
||
import { X as LucideX} from 'lucide-react' | ||
|
||
import Logo from './logo' | ||
import { Sheet, SheetContent, SheetTrigger } from '../primitives/sheet' | ||
|
||
const DrawerMenu: React.FC<PropsWithChildren & { | ||
trigger: ReactNode | ||
className?: string | ||
showLogo?: boolean | ||
}> = ({ | ||
trigger, | ||
children, | ||
className='', | ||
showLogo=true | ||
}) => { | ||
|
||
const [open, setOpen] = React.useState(false) | ||
|
||
const onAction = () => { setOpen(false) } | ||
|
||
// https://stackoverflow.com/a/49052730/11645689 | ||
const updatedChildren = React.Children.map( | ||
children, | ||
(child) => (React.cloneElement( | ||
child as any, { onAction } | ||
)) | ||
) | ||
|
||
return ( | ||
<Sheet open={open} onOpenChange={setOpen} > | ||
<SheetTrigger> | ||
{trigger} | ||
</SheetTrigger> | ||
<SheetContent | ||
side="right" | ||
className={className} | ||
closeButtonClass='text-inherit opacity-90' | ||
onClick={onAction} | ||
closeElement={<LucideX className='h-6 w-6 text-inherit'/>} | ||
centerElement={showLogo ? <Logo size='xs' className='' /> : null} | ||
> | ||
{updatedChildren} | ||
</SheetContent> | ||
</Sheet> | ||
) | ||
} | ||
|
||
export default DrawerMenu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.