Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion frontend/src/js/ui-components/ComboBoxParts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export const listBoxItem = tv({
// explicit: through the portal an item would inherit body's styles
textStyle({ size: 2, tone: "default" }),
"outline-none",
"transition-[background-color] duration-100",
// hover like a menu item; a selected option keeps its tint, one step darker under the pointer
"data-focused:bg-gray-50",
"data-selected:bg-primary-50 data-selected:text-primary-500",
Expand Down
1 change: 0 additions & 1 deletion frontend/src/js/ui-components/GridList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const item = tv({
"rounded",
"cursor-pointer",
"outline-none",
"transition-[background-color] duration-100",
"data-hovered:bg-gray-50",
"data-selected:bg-primary-50 data-selected:text-primary-500",
"data-selected:data-hovered:bg-primary-100",
Expand Down
24 changes: 24 additions & 0 deletions frontend/src/js/ui-components/Menu.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,27 @@ export const WithTooltipOnTrigger: Story = {
</TooltipTrigger>
),
};

const regions = ["North", "South", "East", "West", "Central"];
const manyItems = Array.from({ length: 200 }, (_, i) => ({
id: `item-${i}`,
label: `${regions[i % regions.length]} region ${i + 1}${
i % 3 === 0 ? ", population and products per year" : ""
}`,
}));

/** 200 items: every hover re-renders the whole list (react-aria, see Menu.tsx) */
export const ManyItems: Story = {
render: () => (
<MenuTrigger>
<Button intent="secondary">200 items</Button>
<Menu aria-label="Regions" onAction={(key) => console.log(key)}>
{manyItems.map((item) => (
<MenuItem key={item.id} id={item.id}>
{item.label}
</MenuItem>
))}
</Menu>
</MenuTrigger>
),
};
2 changes: 1 addition & 1 deletion frontend/src/js/ui-components/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ const menuItem = tv({
"whitespace-nowrap",
"cursor-pointer",
"outline-none",
// hover moves focus and re-renders every item, so long menus lag: adobe/react-spectrum#5897
"data-focused:bg-gray-50",
"data-disabled:cursor-not-allowed data-disabled:opacity-40",
"transition-[background-color] duration-100",
],
variants: {
danger: { true: "text-red" },
Expand Down
Loading