Skip to content

Commit

Permalink
fix(app/components/menu): scroll through long list
Browse files Browse the repository at this point in the history
If there is a long list that would overflow beyond the viewport height,
we overflow inside of the menu, instead.
  • Loading branch information
nicholaschiang committed Feb 25, 2024
1 parent c286f41 commit c599216
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/components/menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export type RootProps = {

export function Root({ children }: RootProps) {
return (
<Command className='frosted fixed mt-0.5 flex min-w-min max-w-xl origin-top-left flex-col overflow-hidden rounded-lg border border-gray-200 text-xs shadow-xl will-change-transform dark:border-gray-800'>
<Command className='frosted fixed mt-0.5 flex min-w-min max-w-xl origin-top-left flex-col overflow-hidden rounded-lg border border-gray-200 text-xs shadow-xl will-change-transform dark:border-gray-800 max-h-[calc(100vh_-_84px)]'>
{children}
</Command>
)
Expand Down Expand Up @@ -56,7 +56,9 @@ export type ListProps = { children?: ReactNode }
export function List({ children }: ListProps) {
const count = useCommandState((state) => state.filtered.count)
return (
<Command.List className={cn(count > 0 && 'py-1')}>{children}</Command.List>
<Command.List className={cn('overflow-auto', count > 0 && 'py-1')}>
{children}
</Command.List>
)
}

Expand Down

0 comments on commit c599216

Please sign in to comment.