Skip to content

Commit 72665fe

Browse files
feat: migration of Container
1 parent 64bcee9 commit 72665fe

File tree

5 files changed

+55
-0
lines changed

5 files changed

+55
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules
22
dist
3+
.DS_Store
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React from 'react'
2+
3+
import { ComponentStory, ComponentMeta } from '@storybook/react'
4+
5+
import { Container, ContainerProps } from './Container'
6+
7+
export default {
8+
title: 'atoms/Container',
9+
component: Container
10+
} as ComponentMeta<React.ComponentType<ContainerProps>>
11+
12+
const Template: ComponentStory<React.ComponentType<ContainerProps>> = args => <Container {...args} />
13+
14+
export const Primary = Template.bind({})
15+
Primary.args = {
16+
children: "Hello world"
17+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.container {
2+
display: flex;
3+
}
4+
5+
.centered {
6+
align-items: center;
7+
}
8+
9+
.vertical {
10+
flex-direction: column;
11+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import React, { ReactNode } from 'react'
2+
3+
import cx from 'classnames'
4+
5+
import css from './Container.styles.module.scss'
6+
7+
export type ContainerProps = {
8+
isCentered?: boolean
9+
isVertical?: boolean
10+
id?: string
11+
className?: string | string[]
12+
children?: ReactNode | string
13+
}
14+
15+
export const Container = ({ id, className, children, isCentered, isVertical }: ContainerProps) => (
16+
<div
17+
id={id}
18+
className={cx(className, css.container, {
19+
[css.centered]: isCentered,
20+
[css.vertical]: isVertical
21+
})}
22+
>
23+
{children}
24+
</div>
25+
)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './Container'

0 commit comments

Comments
 (0)