Skip to content

Commit

Permalink
feat: migration of Container
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzhastin-Nikita committed Mar 31, 2022
1 parent 64bcee9 commit 72665fe
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
dist
.DS_Store
17 changes: 17 additions & 0 deletions src/components/atoms/Container/Container.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react'

import { ComponentStory, ComponentMeta } from '@storybook/react'

import { Container, ContainerProps } from './Container'

export default {
title: 'atoms/Container',
component: Container
} as ComponentMeta<React.ComponentType<ContainerProps>>

const Template: ComponentStory<React.ComponentType<ContainerProps>> = args => <Container {...args} />

export const Primary = Template.bind({})
Primary.args = {
children: "Hello world"
}
11 changes: 11 additions & 0 deletions src/components/atoms/Container/Container.styles.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.container {
display: flex;
}

.centered {
align-items: center;
}

.vertical {
flex-direction: column;
}
25 changes: 25 additions & 0 deletions src/components/atoms/Container/Container.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React, { ReactNode } from 'react'

import cx from 'classnames'

import css from './Container.styles.module.scss'

export type ContainerProps = {
isCentered?: boolean
isVertical?: boolean
id?: string
className?: string | string[]
children?: ReactNode | string
}

export const Container = ({ id, className, children, isCentered, isVertical }: ContainerProps) => (
<div
id={id}
className={cx(className, css.container, {
[css.centered]: isCentered,
[css.vertical]: isVertical
})}
>
{children}
</div>
)
1 change: 1 addition & 0 deletions src/components/atoms/Container/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './Container'

0 comments on commit 72665fe

Please sign in to comment.