From 37df4675c09387004ea1bb7ec8b45f1af84e3816 Mon Sep 17 00:00:00 2001 From: tresabhi <43380238+tresabhi@users.noreply.github.com> Date: Thu, 3 Dec 2026 23:21:57 -0600 Subject: [PATCH] curtains --- .../components/DropdownMenu/index.module.css | 156 ++++++++++-------- .../src/components/DropdownMenu/index.tsx | 42 ++++- .../TankSearchFilters/index.module.css | 29 ++-- 3 files changed, 139 insertions(+), 88 deletions(-) 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 ( +
+ {children} + +
+ ); +} + +function Content({ + children, + ...props +}: ComponentProps) { + return ( + + {children} + + ); +} + +function SubContent({ + children, + ...props +}: ComponentProps) { + return ( + + {children} + + ); +} + export const DropdownMenu = { - ...composeRadixComponents(_, styles), + ...composed, + + Content, + SubContent, Discriminator, }; diff --git a/packages/website/src/components/TankSearchFilters/index.module.css b/packages/website/src/components/TankSearchFilters/index.module.css index 3e01fc4dd..58b495afc 100644 --- a/packages/website/src/components/TankSearchFilters/index.module.css +++ b/packages/website/src/components/TankSearchFilters/index.module.css @@ -9,20 +9,6 @@ gap: var(--space-3); - .nation { - .flag { - position: absolute; - top: 0; - right: 0; - - width: var(--space-7); - height: 100%; - - background-size: 200%; - background-position: 0% 50%; - } - } - .plus { color: var(--gray-11); } @@ -44,3 +30,18 @@ } } } + +/* Portaled into the nations dropdown, so it sits outside the scroller */ +.nation { + .flag { + position: absolute; + top: 0; + right: 0; + + width: var(--space-7); + height: 100%; + + background-size: 200%; + background-position: 0% 50%; + } +}