Skip to content

Commit

Permalink
fixup! fixup! Feat(web-react): Add alignmentX and alignmentY prop to …
Browse files Browse the repository at this point in the history
…Grid component #DS-1414
  • Loading branch information
pavelklibani committed Aug 13, 2024
1 parent 085d34a commit ee373ad
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 32 deletions.
15 changes: 5 additions & 10 deletions packages/web-react/src/components/Grid/demo/GridAlignment.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import DocsBox from '../../../../docs/DocsBox';
import Grid from '../Grid';
import GridItem from '../GridItem';

const GridAlignment = () => (
<>
Expand Down Expand Up @@ -39,17 +38,13 @@ const GridAlignment = () => (

<Grid cols={2}>
<Grid cols={1} alignmentX="center" alignmentY="center" UNSAFE_className="bg-cover">
<GridItem>
<DocsBox size="small">
Center
<br />
</DocsBox>
</GridItem>
<DocsBox size="small">
Center
<br />
</DocsBox>
</Grid>
<Grid cols={1} alignmentX="center" alignmentY="center" UNSAFE_className="bg-cover">
<GridItem>
<DocsBox size="small">Center</DocsBox>
</GridItem>
<DocsBox size="small">Center</DocsBox>
</Grid>
</Grid>

Expand Down
47 changes: 25 additions & 22 deletions packages/web-react/src/components/Grid/stories/Grid.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ const meta: Meta<typeof Grid> = {
defaultValue: { summary: undefined },
},
},
children: {
control: 'object',
},
cols: {
control: 'object',
},
Expand All @@ -54,25 +51,6 @@ const meta: Meta<typeof Grid> = {
args: {
alignmentX: undefined,
alignmentY: undefined,
children: (
<>
{[...Array(12)].map((_, index) => {
const key = `item-${index}`;

return (
<DocsBox key={key}>
{index === 11 ? (
<>
Item <br /><br />
</>
) : (
'Item'
)}
</DocsBox>
);
})}
</>
),
cols: {
mobile: 2,
tablet: 3,
Expand Down Expand Up @@ -102,4 +80,29 @@ type Story = StoryObj<typeof Grid>;

export const Playground: Story = {
name: 'Grid',
render: (args) => {
const { alignmentX, alignmentY, ...restProps } = args;

return (
<Grid {...restProps}>
{[...Array(12)].map((_, index) => {
const key = `item-${index}`;

return (
<Grid key={key} cols={1} alignmentX={alignmentX} alignmentY={alignmentY} UNSAFE_className="bg-cover">
<DocsBox key={key}>
{index === 11 ? (
<>
Item <br /><br />
</>
) : (
'Item'
)}
</DocsBox>
</Grid>
);
})}
</Grid>
);
},
};

0 comments on commit ee373ad

Please sign in to comment.