Skip to content

Commit

Permalink
chore(AspectRatio): added Storybook Controls (#12383)
Browse files Browse the repository at this point in the history
* chore(aspect-ratio): scaffolding

* chore(aspect-ratio): updated controls
  • Loading branch information
sstrubberg committed Oct 27, 2022
1 parent 607b441 commit ad3b045
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 107 deletions.
75 changes: 0 additions & 75 deletions packages/react/src/components/AspectRatio/AspectRatio-story.js

This file was deleted.

4 changes: 2 additions & 2 deletions packages/react/src/components/AspectRatio/AspectRatio.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Story, Props, Source, Preview } from '@storybook/addon-docs';
import { Grid, Row, Column } from '../Grid';
import { AspectRatio } from '../AspectRatio';
import { AspectRatio } from '.';

# AspectRatio

Expand Down Expand Up @@ -28,7 +28,7 @@ spanning 100% of the space available in your layout, and the height will be
determined by the ratio that you specified.

<Preview>
<Story id="components-aspectratio--aspect-ratio-story" />
<Story id="components-aspectratio--default" />
</Preview>

To see the full list of ratios supported by the `ratio` prop, check out the prop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
* LICENSE file in the root directory of this source tree.
*/

import '../AspectRatio-story.scss';
import './AspectRatio-story.scss';

import React from 'react';
import { Grid, Column } from '../../Grid';
import { AspectRatio } from '../';
import mdx from '../AspectRatio.mdx';
import { Grid, Column } from '../Grid';
import { AspectRatio } from './';
import mdx from './AspectRatio.mdx';

export default {
title: 'Components/AspectRatio',
Expand Down Expand Up @@ -49,33 +49,9 @@ export const Default = () => {
};

export const Playground = {
argTypes: {
as: {
control: {
type: null,
},
},
children: {
control: {
type: null,
},
},
className: {
control: {
type: null,
},
},
ratio: {
control: {
type: 'select',
},
defaultValue: '1x1',
options: ['16x9', '9x16', '2x1', '1x2', '4x3', '3x4', '1x1'],
},
},
render: ({ ratio }) => {
render: ({ ratio }, ...args) => {
return (
<Grid>
<Grid {...args}>
<Column sm={1} md={2} lg={4}>
<AspectRatio ratio={ratio}>Content</AspectRatio>
</Column>
Expand All @@ -92,3 +68,28 @@ export const Playground = {
);
},
};

Playground.argTypes = {
as: {
table: {
disable: true,
},
},
children: {
table: {
disable: true,
},
},
className: {
table: {
disable: true,
},
},
ratio: {
control: {
type: 'select',
},
defaultValue: '1x1',
options: ['16x9', '9x16', '2x1', '1x2', '4x3', '3x4', '1x1'],
},
};

0 comments on commit ad3b045

Please sign in to comment.