diff --git a/packages/website/src/components/DropdownMenu/index.module.css b/packages/website/src/components/DropdownMenu/index.module.css index 1d09516d5..ae186ec36 100644 --- a/packages/website/src/components/DropdownMenu/index.module.css +++ b/packages/website/src/components/DropdownMenu/index.module.css @@ -7,7 +7,7 @@ max-height: calc( var(--radix-dropdown-menu-content-available-height) - var(--space-6) ); - overflow-y: auto; + overflow: hidden; z-index: 1; background-color: var(--gray-2); @@ -21,96 +21,106 @@ border-radius: var(--space-4); outline: var(--outline-interactive) !important; - scrollbar-width: none; - -ms-overflow-style: none; - - &::-webkit-scrollbar { - display: none; - } - - .Separator { - flex-shrink: 0; - height: var(--space-3); - } - - .Label { - font-size: var(--font-size-minor); - - color: var(--gray-11); - - padding: var(--space-3); - padding-left: var(--gutter); - - * + & { - margin-top: var(--space-3); - } - } - - .Item, - .CheckboxItem, - .RadioItem, - .SubTrigger { - position: relative; - - background-color: var(--gray-3); - - padding: var(--space-3); - padding-left: var(--gutter); - - cursor: pointer; - user-select: none; + .viewport { + flex: 1 1 auto; + min-height: 0; + overflow-y: auto; display: flex; - align-items: center; - gap: var(--space-3); + flex-direction: column; - font-size: var(--font-size-minor); + scrollbar-width: none; + -ms-overflow-style: none; - &:focus { - outline: none; - - background-color: var(--gray-5); + &::-webkit-scrollbar { + display: none; } - &:not(:last-child) { - border-bottom: var(--space-1) solid var(--gray-2); + .Separator { + flex-shrink: 0; + height: var(--space-3); } - &[data-accent] { - color: var(--accent-11); - } + .Label { + font-size: var(--font-size-minor); - /** - * This is actually .ItemText, but its class name isn't being passed to the - * html, so I am selecting the span instead. - */ - span { - display: contents; - } + color: var(--gray-11); - img, - svg { - width: 1em; - height: 1em; + padding: var(--space-3); + padding-left: var(--gutter); - &:last-child { - margin-left: auto; + * + & { + margin-top: var(--space-3); } } - .discriminator { - display: inline; - margin-left: auto; - } + .Item, + .CheckboxItem, + .RadioItem, + .SubTrigger { + position: relative; - .ItemIndicator { - position: absolute; - left: 0; - top: 50%; + background-color: var(--gray-3); + + padding: var(--space-3); + padding-left: var(--gutter); + + cursor: pointer; + user-select: none; display: flex; + align-items: center; + gap: var(--space-3); - transform: translate(calc(-50% + var(--gutter) / 2), -50%); + font-size: var(--font-size-minor); + + &:focus { + outline: none; + + background-color: var(--gray-5); + } + + /* Of type, since the curtains' anchor span trails the items */ + &:not(:last-of-type) { + border-bottom: var(--space-1) solid var(--gray-2); + } + + &[data-accent] { + color: var(--accent-11); + } + + /** + * This is actually .ItemText, but its class name isn't being passed to the + * html, so I am selecting the span instead. + */ + span { + display: contents; + } + + img, + svg { + width: 1em; + height: 1em; + + &:last-child { + margin-left: auto; + } + } + + .discriminator { + display: inline; + margin-left: auto; + } + + .ItemIndicator { + position: absolute; + left: 0; + top: 50%; + + display: flex; + + transform: translate(calc(-50% + var(--gutter) / 2), -50%); + } } } } diff --git a/packages/website/src/components/DropdownMenu/index.tsx b/packages/website/src/components/DropdownMenu/index.tsx index 7cf70c2f0..95aa2fe46 100644 --- a/packages/website/src/components/DropdownMenu/index.tsx +++ b/packages/website/src/components/DropdownMenu/index.tsx @@ -2,8 +2,12 @@ import { DropdownMenu as _ } from "radix-ui"; import type { ComponentProps } from "react"; import { classNames } from "../../ui/classNames"; import { composeRadixComponents } from "../../ui/compose"; +import { ScrollerOrientation } from "../Scroller"; +import { ScrollerCurtains } from "../ScrollerCurtains"; import styles from "./index.module.css"; +const composed = composeRadixComponents(_, styles); + // Trailing text pushed to the right of an item, like flags or shortcuts export function Discriminator({ className, ...props }: ComponentProps<"span">) { return ( @@ -11,7 +15,43 @@ export function Discriminator({ className, ...props }: ComponentProps<"span">) { ); } +// Scrolls the items inside the content's rounded frame so the curtains fade +// them into its background instead of fading the frame itself +function Viewport({ children }: ComponentProps<"div">) { + return ( +