Skip to content
This repository was archived by the owner on Feb 27, 2024. It is now read-only.

Commit 863e5c6

Browse files
committed
Add Container component and story
1 parent 95a1cac commit 863e5c6

File tree

4 files changed

+38
-0
lines changed

4 files changed

+38
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import PropTypes from 'prop-types'
2+
import React from 'react'
3+
import styles from './Container.module.css'
4+
5+
/**
6+
* Render the Container component.
7+
*
8+
* @param {object} props Container component props.
9+
* @param {Element} props.children Container children.
10+
* @return {Element} The Container component.
11+
*/
12+
export default function Container({children}) {
13+
return <div className={styles.containerW}>{children && children}</div>
14+
}
15+
16+
Container.propTypes = {
17+
children: PropTypes.element
18+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.containerW {
2+
@apply container;
3+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import {Canvas, Meta, Story} from '@storybook/addon-docs/blocks'
2+
import Container from './'
3+
4+
<Meta title="Components/Atoms/Container" component={Container} />
5+
6+
# Component
7+
8+
Use this to wrap another component in a container. This will limit the max width of everything inside of it. See [the tailwind container docs](https://tailwindcss.com/docs/container) for details.
9+
10+
<Canvas>
11+
<Story name="Component">
12+
<Container>
13+
<div className="p-32 bg-black text-white">I am contained.</div>
14+
</Container>
15+
</Story>
16+
</Canvas>

components/atoms/Container/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {default} from './Container'

0 commit comments

Comments
 (0)