This repository has been archived by the owner on Sep 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Cecilia Woodward
committed
Aug 20, 2021
1 parent
542e280
commit 905a2bc
Showing
6 changed files
with
100 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) => <Grid {...args} />; | ||
|
||
export const Vertical = Template.bind({}); | ||
Vertical.args = { | ||
children: ( | ||
<> | ||
<Button> | ||
<Icon icon='delete' /> | ||
</Button> | ||
<Button> | ||
<Icon icon='share' /> | ||
</Button> | ||
</> | ||
), | ||
layout: Layout.Vertical, | ||
}; | ||
|
||
export const Horizontal = Template.bind({}); | ||
Horizontal.args = { | ||
children: ( | ||
<> | ||
<Button> | ||
<Icon icon='share'/> | ||
</Button> | ||
<Button> | ||
<Icon icon='delete'/> | ||
</Button> | ||
</> | ||
), | ||
layout: Layout.Horizontal, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<GridProps> = ({ | ||
children, | ||
className, | ||
layout = Layout.Vertical, | ||
spacing = 10, | ||
}: GridProps) => { | ||
return ( | ||
<div | ||
className={classNames( | ||
styles.grid, | ||
styles[layout], | ||
className, | ||
)} | ||
style={{ gap: `${spacing}px` }} | ||
> | ||
{children} | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,11 @@ | ||
@use './variables' as *; | ||
|
||
.card { | ||
display: grid; | ||
gap: 10px; | ||
border-radius: $border-radius; | ||
background-color: $secondary; | ||
color: $primary-accent; | ||
padding: $padding; | ||
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters