-
Notifications
You must be signed in to change notification settings - Fork 4k
Fix sublinks display on mobile #2620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ export function Dropdown<E extends HTMLElement>(props: { | |
aria-labelledby={dropdownId} | ||
className={tcls( | ||
'w-52', | ||
'max-h-56', | ||
'max-h-80', | ||
'flex', | ||
'absolute', | ||
'top-full', | ||
|
@@ -111,31 +111,38 @@ export function DropdownMenu(props: { children: React.ReactNode }) { | |
* Menu item in a dropdown. | ||
*/ | ||
export function DropdownMenuItem(props: { | ||
href: string; | ||
href: string | null; | ||
active?: boolean; | ||
className?: ClassValue; | ||
children: React.ReactNode; | ||
}) { | ||
const { children, active = false, href } = props; | ||
const { children, active = false, href, className } = props; | ||
|
||
if (href) { | ||
return ( | ||
<Link | ||
href={href} | ||
prefetch={false} | ||
className={tcls( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Curious to know why we went for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a mistake, but it's like that from the beginning. At some point we should change it to improve perfs. |
||
'px-3 py-1 text-sm rounded straight-corners:rounded-sm', | ||
active ? 'bg-primary/3 dark:bg-light/2 text-primary-600' : null, | ||
'hover:bg-dark/2 dark:hover:bg-light/2', | ||
className, | ||
)} | ||
> | ||
{children} | ||
</Link> | ||
); | ||
} | ||
|
||
return ( | ||
<Link | ||
href={href} | ||
prefetch={false} | ||
<div | ||
className={tcls( | ||
'flex', | ||
'flex-row', | ||
'items-center', | ||
'text-sm', | ||
'px-3', | ||
'py-1', | ||
'rounded', | ||
'straight-corners:rounded-sm', | ||
active | ||
? ['bg-primary/3', 'dark:bg-light/2', 'text-primary-600'] | ||
: ['hover:bg-dark/2', 'dark:hover:bg-light/2'], | ||
'text-xs px-3 py-1 font-medium text-dark/8 dark:text-light/8', | ||
className, | ||
)} | ||
> | ||
{children} | ||
</Link> | ||
</div> | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not familiar with the GBO dev env yet : why isn't that a string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We manipulate
clsx
values, but IMO we should not. All components should only accept aclassName?: string
and if you need to merge thing you can do it when you pass the prop:<Any className={clsx(...)} />
like we do in the app.