Skip to content

Commit

Permalink
SSR support fixes [prerelease]
Browse files Browse the repository at this point in the history
  • Loading branch information
MosheZemah committed Oct 6, 2024
1 parent 7f17e80 commit 67dda49
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 381 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ A dropdown menu can include labels.

<Canvas of={DropdownStories.DropdownWithLabels} />

### Dropdown with virtualized items

A dropdown with many items, can be virtualized using `isVirtualized`.

<Canvas of={DropdownStories.VirtualizedDropdown} />

### Dropdown inside a form

A classic dropdown presents options a user needs to choose from.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,11 @@ export const fakeFetchUsers = () => {
}, 1000);
});
};

export const generateItems = (itemsCount = 100) => {
const items = [];
for (let i = 0; i < itemsCount; i++) {
items.push({ value: i, label: `Item ${i}` });
}
return items;
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Attach, Email } from "../../Icon/Icons";
import { Avatar, Box, Button, DialogContentContainer, Dropdown, Flex, Label, Modal, ModalContent } from "../../index";
import ModalExampleContent from "../../../storybook/patterns/dropdown-in-modals/ModalExampleContent";
import "./Dropdown.stories.scss";
import { fakeFetchUsers } from "./Dropdown.stories.helpers";
import { fakeFetchUsers, generateItems } from "./Dropdown.stories.helpers";

const metaSettings = createStoryMetaSettingsDecorator({
component: Dropdown,
Expand Down Expand Up @@ -673,6 +673,15 @@ export const DropdownWithLabels = {
name: "Dropdown with labels"
};

export const VirtualizedDropdown = {
render: () => {
const options = useMemo(() => generateItems(300), []);

return <Dropdown options={options} isVirtualized className="dropdown-stories-styles_with-chips" />;
},
name: "Virtualized dropdown"
};

export const DropdownInsideAForm = {
render: () => {
const options = useMemo(
Expand Down
Loading

0 comments on commit 67dda49

Please sign in to comment.