diff --git a/stories/Card.tsx b/stories/Card.tsx index 4014f83..375985f 100644 --- a/stories/Card.tsx +++ b/stories/Card.tsx @@ -2,6 +2,7 @@ import classNames from 'classnames'; import React, { FunctionComponent, ReactNode } from 'react'; import styles from './card.scss'; import { Layout } from './constants'; +import { Grid } from './Grid'; export interface CardProps { children?: ReactNode; @@ -16,15 +17,15 @@ export const Card: FunctionComponent = ({ ...props }: CardProps) => { return ( -
{children} -
+ ); }; diff --git a/stories/Grid.scss b/stories/Grid.scss new file mode 100644 index 0000000..21008c9 --- /dev/null +++ b/stories/Grid.scss @@ -0,0 +1,13 @@ +.grid { + display: grid; + + &.horizontal { + grid-auto-columns: min-content; + grid-auto-flow: column; + } + + &.vertical { + grid-auto-rows: auto; + grid-auto-flow: row; + } +} diff --git a/stories/Grid.stories.tsx b/stories/Grid.stories.tsx new file mode 100644 index 0000000..8407f26 --- /dev/null +++ b/stories/Grid.stories.tsx @@ -0,0 +1,50 @@ +import React from 'react'; +import { Button } from './Button'; + +import { Grid, GridProps } from './Grid'; +import { Layout } from './constants'; +import { Icon } from './Icon'; + +export default { + title: 'Components/Grid', + component: Grid, + argTypes: { + children: { + table:{ + disable: true, + }, + }, + }, +}; + +const Template = (args: GridProps) => ; + +export const Vertical = Template.bind({}); +Vertical.args = { + children: ( + <> + + + + ), + layout: Layout.Vertical, +}; + +export const Horizontal = Template.bind({}); +Horizontal.args = { + children: ( + <> + + + + ), + layout: Layout.Horizontal, +}; diff --git a/stories/Grid.tsx b/stories/Grid.tsx new file mode 100644 index 0000000..1602c6b --- /dev/null +++ b/stories/Grid.tsx @@ -0,0 +1,32 @@ +import classNames from 'classnames'; +import React, { FunctionComponent, ReactNode } from 'react'; +import { Layout } from './constants'; + +import styles from './Grid.scss'; + +export interface GridProps { + children: ReactNode; + className?: string; + layout?: Layout; + spacing?: number; +} + +export const Grid: FunctionComponent = ({ + children, + className, + layout = Layout.Vertical, + spacing = 10, +}: GridProps) => { + return ( +
+ {children} +
+ ); +}; diff --git a/stories/card.scss b/stories/card.scss index 8abde44..1f86252 100644 --- a/stories/card.scss +++ b/stories/card.scss @@ -1,8 +1,6 @@ @use './variables' as *; .card { - display: grid; - gap: 10px; border-radius: $border-radius; background-color: $secondary; color: $primary-accent; @@ -10,14 +8,4 @@ box-shadow: 0px 2px 2px 0px rgb(0 0 0 / 50%); font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; - - &.horizontal { - grid-auto-columns: min-content; - grid-auto-flow: column; - } - - &.vertical { - grid-auto-rows: auto; - grid-auto-flow: row; - } } diff --git a/stories/index.tsx b/stories/index.tsx index 823d3e3..4a544f1 100644 --- a/stories/index.tsx +++ b/stories/index.tsx @@ -5,3 +5,4 @@ export { Card } from './Card'; export { Checkbox } from './Checkbox'; export { Icon } from './Icon'; export { Input } from './Input'; +export { Grid } from './Grid';