mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-12-04 23:32:54 +01:00
curtains
This commit is contained in:
3 files changed
+68
-17
No files matched your search
@@ -7,7 +7,7 @@
|
|||||||
max-height: calc(
|
max-height: calc(
|
||||||
var(--radix-dropdown-menu-content-available-height) - var(--space-6)
|
var(--radix-dropdown-menu-content-available-height) - var(--space-6)
|
||||||
);
|
);
|
||||||
overflow-y: auto;
|
overflow: hidden;
|
||||||
|
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
background-color: var(--gray-2);
|
background-color: var(--gray-2);
|
||||||
@@ -21,6 +21,14 @@
|
|||||||
border-radius: var(--space-4);
|
border-radius: var(--space-4);
|
||||||
outline: var(--outline-interactive) !important;
|
outline: var(--outline-interactive) !important;
|
||||||
|
|
||||||
|
.viewport {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
min-height: 0;
|
||||||
|
overflow-y: auto;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
scrollbar-width: none;
|
scrollbar-width: none;
|
||||||
-ms-overflow-style: none;
|
-ms-overflow-style: none;
|
||||||
|
|
||||||
@@ -72,7 +80,8 @@
|
|||||||
background-color: var(--gray-5);
|
background-color: var(--gray-5);
|
||||||
}
|
}
|
||||||
|
|
||||||
&:not(:last-child) {
|
/* Of type, since the curtains' anchor span trails the items */
|
||||||
|
&:not(:last-of-type) {
|
||||||
border-bottom: var(--space-1) solid var(--gray-2);
|
border-bottom: var(--space-1) solid var(--gray-2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,3 +123,4 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -2,8 +2,12 @@ import { DropdownMenu as _ } from "radix-ui";
|
|||||||
import type { ComponentProps } from "react";
|
import type { ComponentProps } from "react";
|
||||||
import { classNames } from "../../ui/classNames";
|
import { classNames } from "../../ui/classNames";
|
||||||
import { composeRadixComponents } from "../../ui/compose";
|
import { composeRadixComponents } from "../../ui/compose";
|
||||||
|
import { ScrollerOrientation } from "../Scroller";
|
||||||
|
import { ScrollerCurtains } from "../ScrollerCurtains";
|
||||||
import styles from "./index.module.css";
|
import styles from "./index.module.css";
|
||||||
|
|
||||||
|
const composed = composeRadixComponents(_, styles);
|
||||||
|
|
||||||
// Trailing text pushed to the right of an item, like flags or shortcuts
|
// Trailing text pushed to the right of an item, like flags or shortcuts
|
||||||
export function Discriminator({ className, ...props }: ComponentProps<"span">) {
|
export function Discriminator({ className, ...props }: ComponentProps<"span">) {
|
||||||
return (
|
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 (
|
||||||
|
<div className={styles.viewport}>
|
||||||
|
{children}
|
||||||
|
<ScrollerCurtains orientation={ScrollerOrientation.Vertical} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function Content({
|
||||||
|
children,
|
||||||
|
...props
|
||||||
|
}: ComponentProps<typeof composed.Content>) {
|
||||||
|
return (
|
||||||
|
<composed.Content {...props}>
|
||||||
|
<Viewport>{children}</Viewport>
|
||||||
|
</composed.Content>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function SubContent({
|
||||||
|
children,
|
||||||
|
...props
|
||||||
|
}: ComponentProps<typeof composed.SubContent>) {
|
||||||
|
return (
|
||||||
|
<composed.SubContent {...props}>
|
||||||
|
<Viewport>{children}</Viewport>
|
||||||
|
</composed.SubContent>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export const DropdownMenu = {
|
export const DropdownMenu = {
|
||||||
...composeRadixComponents(_, styles),
|
...composed,
|
||||||
|
|
||||||
|
Content,
|
||||||
|
SubContent,
|
||||||
Discriminator,
|
Discriminator,
|
||||||
};
|
};
|
||||||
@@ -9,20 +9,6 @@
|
|||||||
|
|
||||||
gap: var(--space-3);
|
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 {
|
.plus {
|
||||||
color: var(--gray-11);
|
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%;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user