Skip to content

Commit

Permalink
frontend: fix drawer (#2730)
Browse files Browse the repository at this point in the history
### Description
Adding fill to array, build storybook is making the array empty

---------

Co-authored-by: Josh Slaughter <[email protected]>
  • Loading branch information
roier and jdslaugh authored Jul 14, 2023
1 parent 09a2d1d commit a69ccb2
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default {
displayName: "EC2",
group: "AWS",
path: "ec2",
icon: { path: "" },
routes: [
{
component: () => null,
Expand Down
6 changes: 3 additions & 3 deletions frontend/packages/core/src/Table/stories/table.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ export default {
const Template = ({ row, ...props }: TableProps & { row: React.ReactElement }) => (
<div style={{ maxHeight: "300px", display: "flex" }}>
<Table {...props} columns={["Column 1", "Column 2", "Column 3", "Column 4", "Column 5"]}>
{
{Array(10)
.fill(null)
// eslint-disable-next-line react/no-array-index-key
[...Array(10)].map((_, index: number) => React.cloneElement(row, { key: index }))
}
.map((_, index: number) => React.cloneElement(row, { key: index }))}
</Table>
</div>
);
Expand Down
26 changes: 15 additions & 11 deletions frontend/packages/core/src/stories/stepper.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ const PrimaryTemplate = ({ stepCount, activeStep }: StepperProps & { stepCount:
return (
<>
<Stepper activeStep={curStep}>
{[...Array(stepCount)].map((_, index: number) => (
// eslint-disable-next-line react/no-array-index-key
<Step key={index} label={`Step ${index + 1}`} />
))}
{Array(stepCount)
.fill(null)
.map((_, index: number) => (
// eslint-disable-next-line react/no-array-index-key
<Step key={index} label={`Step ${index + 1}`} />
))}
</Stepper>
<div>
<Text>Step{curStep + 1} content</Text>
Expand Down Expand Up @@ -73,13 +75,15 @@ const FailureTemplate = ({ failedStep = 2, activeStep }: StepperProps & { failed
return (
<>
<Stepper activeStep={curStep}>
{[...Array(stepCount)].map((_, index: number) => (
<Step
error={curStep === failedStep && index === failedStep}
key={index} // eslint-disable-line react/no-array-index-key
label={`Step ${index + 1}`}
/>
))}
{Array(stepCount)
.fill(null)
.map((_, index: number) => (
<Step
error={curStep === failedStep && index === failedStep}
key={index} // eslint-disable-line react/no-array-index-key
label={`Step ${index + 1}`}
/>
))}
</Stepper>
<div>
<Text>Step{curStep + 1} content</Text>
Expand Down
14 changes: 8 additions & 6 deletions frontend/packages/core/src/stories/tabs.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ export default {

const Template = ({ tabCount, value, variant }: TabsProps & { tabCount: number }) => (
<Tabs value={value - 1} variant={variant}>
{[...Array(tabCount)].map((_, index: number) => (
// eslint-disable-next-line react/no-array-index-key
<Tab key={index} label={`Tab ${index + 1}`} value={index}>
<div>Tab{index + 1} Content</div>
</Tab>
))}
{Array(tabCount)
.fill(null)
.map((_, index: number) => (
// eslint-disable-next-line react/no-array-index-key
<Tab key={index} label={`Tab ${index + 1}`} value={index}>
<div>Tab{index + 1} Content</div>
</Tab>
))}
</Tabs>
);

Expand Down

0 comments on commit a69ccb2

Please sign in to comment.