From 58ea2b77a1253e23a236da60e2333804c2c13ca3 Mon Sep 17 00:00:00 2001 From: Hunter Miller Date: Thu, 16 Sep 2021 17:05:29 -0500 Subject: [PATCH] nav: better close behavior and small tweaks --- pkg/grid/src/nav/Leap.tsx | 4 ++-- pkg/grid/src/nav/Nav.tsx | 2 ++ pkg/grid/src/nav/NotificationsLink.tsx | 26 +++++++++++++++++++---- pkg/grid/src/nav/SystemMenu.tsx | 29 +++++++++++++++++++------- pkg/grid/src/nav/search/Home.tsx | 4 ++-- pkg/grid/src/styles/components.css | 2 +- 6 files changed, 50 insertions(+), 17 deletions(-) diff --git a/pkg/grid/src/nav/Leap.tsx b/pkg/grid/src/nav/Leap.tsx index 25c4882a1..1bccbaa65 100644 --- a/pkg/grid/src/nav/Leap.tsx +++ b/pkg/grid/src/nav/Leap.tsx @@ -236,7 +236,7 @@ export const Leap = React.forwardRef( type="text" ref={inputRef} placeholder={selection ? '' : 'Search Landscape'} - className="flex-1 w-full h-full px-2 h4 rounded-full bg-transparent outline-none" + className="flex-1 w-full h-full px-2 h4 text-base rounded-full bg-transparent outline-none" value={rawInput} onClick={toggleSearch} onFocus={onFocus} @@ -247,7 +247,7 @@ export const Leap = React.forwardRef( aria-activedescendant={selectedMatch?.display || selectedMatch?.value} /> - {navOpen && ( + {menu === 'search' && ( = ({ menu }) => { > 0) { return 'attention-needed'; } @@ -25,20 +31,26 @@ function getNotificationsState( type NotificationsLinkProps = Omit, 'to'> & { navOpen: boolean; + notificationsOpen: boolean; shouldDim: boolean; }; -export const NotificationsLink = ({ navOpen, shouldDim }: NotificationsLinkProps) => { +export const NotificationsLink = ({ + navOpen, + notificationsOpen, + shouldDim +}: NotificationsLinkProps) => { const { notifications, systemNotifications } = useNotifications(); - const state = getNotificationsState(notifications, systemNotifications); + const state = getNotificationsState(notificationsOpen, notifications, systemNotifications); return ( Attention needed )} + {state === 'open' && ( + <> + + Close + + )} ); }; diff --git a/pkg/grid/src/nav/SystemMenu.tsx b/pkg/grid/src/nav/SystemMenu.tsx index 8397f7755..990ed915a 100644 --- a/pkg/grid/src/nav/SystemMenu.tsx +++ b/pkg/grid/src/nav/SystemMenu.tsx @@ -8,9 +8,11 @@ import { Adjust } from '../components/icons/Adjust'; import { useVat } from '../state/kiln'; import { disableDefault, handleDropdownLink } from '../state/util'; import { useMedia } from '../logic/useMedia'; +import { Cross } from '../components/icons/Cross'; type SystemMenuProps = HTMLAttributes & { open: boolean; + subMenuOpen: boolean; shouldDim: boolean; }; @@ -19,7 +21,7 @@ function getHash(vat: Vat): string { return parts[parts.length - 1]; } -export const SystemMenu = ({ className, open, shouldDim }: SystemMenuProps) => { +export const SystemMenu = ({ className, open, subMenuOpen, shouldDim }: SystemMenuProps) => { const { push } = useHistory(); const [copied, setCopied] = useState(false); const garden = useVat('garden'); @@ -53,19 +55,30 @@ export const SystemMenu = ({ className, open, shouldDim }: SystemMenuProps) => { open={open} onOpenChange={(isOpen) => setTimeout(() => !isOpen && push('/'), 15)} > - - - System Menu - + {!open && !subMenuOpen && ( + <> + + System Menu + + )} + {(open || subMenuOpen) && ( + <> + + Close + + )} + {/* trigger here just for anchoring the dropdown */} + + { Recent Apps {recentApps.length === 0 && ( -
+

Apps you use will be listed here, in the order you used them.

You can click/tap/keyboard on a listed app to open it.

{groups && ( @@ -122,7 +122,7 @@ export const Home = () => { Recent Developers {recentDevs.length === 0 && ( -
+

Urbit app developers you search for will be listed here.

{zod && ( <> diff --git a/pkg/grid/src/styles/components.css b/pkg/grid/src/styles/components.css index 53335b024..ff8690e1e 100644 --- a/pkg/grid/src/styles/components.css +++ b/pkg/grid/src/styles/components.css @@ -27,7 +27,7 @@ } .input { - @apply px-4 py-2 w-full bg-white rounded-xl; + @apply px-4 py-2 w-full text-base sm:text-sm bg-white rounded-xl; } .notification {