Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert VirtualizedList stories helpers file to TS #2531

Merged
merged 3 commits into from
Oct 20, 2024
Merged
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@
import React from "react";
import { Tip } from "vibe-storybook-components";

export const generateItems = (defaultItemSize = 30, itemsCount, layout) => {
const items = [];
export const generateItems = (defaultItemSize: number = 30, itemsCount: number, layout: string) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the type from defaultItemSize as it inferred from the default value
See CI check

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made the change in the latest commit
please check if it is correct

const items: { value: string; size: number; id: number; height: number }[] = [];
const isVertical = layout !== "horizontal";

for (let i = 0; i < itemsCount; i++) {
const size = (i > 0 && i % 15) === 0 ? defaultItemSize * 2 : defaultItemSize;
items.push({ value: `Item ${i}`, size, id: i, height: isVertical ? size : 30 });
}

return items;
};

export const TipItemRenderer = () => (
export const TipItemRenderer: React.FC = () => (
<Tip title="Are your list items not rendered correctly?">
Please make sure you inject the style parameter of the <code>itemRenderer</code> function to the item {"element's"}
wrapper style.
Expand Down
Loading