Skip to content

Commit 3f4fdf9

Browse files
shiftypSaraVieira
authored andcommitted
Added flex playground 🚀 (codesandbox#2271)
* Added flex playground 🚀 * Added repeats to flex playground * Spelling
1 parent 88fceef commit 3f4fdf9

File tree

1 file changed

+38
-2
lines changed

1 file changed

+38
-2
lines changed

packages/common/src/components/flex/index.stories.tsx

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ const withFullscreenBordered = (fn: RenderFunction) => (
9797
<FullscreenBordered>{fn()}</FullscreenBordered>
9898
);
9999

100-
const ColumnBordered = makeBorderedContainer('Column', Column, 'yellow');
100+
const ColumnBordered = makeBorderedContainer('Column', Column, 'purple');
101101

102102
const withColumnBordered = (fn: RenderFunction) => (
103103
<ColumnBordered
@@ -189,4 +189,40 @@ storiesOf('components/flex', module)
189189
)
190190
.add('MaxWidth > Row', () =>
191191
withMaxWidthBordered(repeat('Row', () => withRowBordered(makeContent)))
192-
);
192+
)
193+
.add('Playground \uD83D\uDE80', () => {
194+
let decorators = [];
195+
let current = null;
196+
197+
do {
198+
current = select(
199+
`Component ${decorators.length}`,
200+
['Fullscreen', 'MaxWidth', 'Centered', 'Row', 'Column', null],
201+
null,
202+
'structure'
203+
);
204+
205+
switch (current) {
206+
case 'Fullscreen':
207+
decorators.push(withFullscreenBordered);
208+
break;
209+
case 'MaxWidth':
210+
decorators.push(withMaxWidthBordered);
211+
break;
212+
case 'Centered':
213+
decorators.push(withCenteredBordered);
214+
break;
215+
case 'Row':
216+
decorators.push(withRowBordered);
217+
break;
218+
case 'Column':
219+
decorators.push(withColumnBordered);
220+
break;
221+
}
222+
} while (current);
223+
224+
return decorators.reduceRight(
225+
(last, decorator, i) => repeat(`Component ${i}`, () => decorator(last)),
226+
makeContent
227+
)();
228+
});

0 commit comments

Comments
 (0)