Skip to content

Commit

Permalink
Attempt repro for #19575
Browse files Browse the repository at this point in the history
  • Loading branch information
shilman committed Dec 23, 2023
1 parent a2c325e commit 9909e3c
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions code/renderers/react/template/stories/dynamic-jsx.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import React from 'react';

const SlideshowArray = ({ page, pages }: { page: number; pages: React.ReactElement[] }) => {
const Page = pages[page];
return Page;
};

export default {
component: SlideshowArray,
parameters: { chromatic: { disable: true } },
args: {
pages: [<>Page 0</>, <>Page 1</>, <>Page 2</>],
},
tags: ['autodocs'],
};

export const Page0 = {
args: { page: 0 },
};

export const Page1 = {
args: { page: 1 },
};

const SlideshowObject = ({
page,
pages,
}: {
page: number;
pages: Record<string, React.ReactElement>;
}) => {
const Page = pages[page];
return Page;
};

export const PageObject = {
args: {
page: 1,
pages: {
0: <>Page 0</>,
1: <>Page 1</>,
2: <>Page 2</>,
},
},
render: (args: any) => <SlideshowObject {...args} />,
};

const SlideshowNested = ({
page,
pages,
}: {
page: number;
pages: Record<string, React.ReactElement>[];
}) => {
const Page = pages[page][page];
return Page;
};

export const PageNested = {
args: {
page: 1,
pages: [{ 0: <>Page 0</> }, { 1: <>Page 1</> }, { 2: <>Page 2</> }],
},
render: (args: any) => <SlideshowNested {...args} />,
};

0 comments on commit 9909e3c

Please sign in to comment.