This repository has been archived by the owner on Aug 29, 2023. It is now read-only.
generated from ost-cas-fee-adv-22-23/cas-fee-adv-design-system-tpl
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from smartive-education/feature/container
- Loading branch information
Showing
3 changed files
with
84 additions
and
24 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
packages/design-system-component-library-yeahyeahyeah/components/Container.tsx
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,28 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import tw from 'twin.macro'; | ||
|
||
export interface IContainerProps { | ||
children?: React.ReactNode; | ||
layout: 'plain' | 'box'; | ||
} | ||
|
||
export const Container: React.FC<IContainerProps> = (props: IContainerProps) => { | ||
const { layout = 'colored', children } = props; | ||
|
||
return <SectionWrapper layout={layout}>{children}</SectionWrapper>; | ||
}; | ||
|
||
interface ContainerStyles { | ||
layout: string; | ||
} | ||
|
||
const SectionWrapper = styled.section(({ layout }: ContainerStyles) => [ | ||
tw` | ||
container | ||
mx-4 | ||
sm:mx-auto | ||
`, | ||
layout === 'box' && tw`bg-slate-white rounded-lg py-8 mx-4`, | ||
layout === 'plain' && tw`bg-none px-4 bg-violet-400`, | ||
]); |
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
27 changes: 27 additions & 0 deletions
27
packages/design-system-component-library-yeahyeahyeah/stories/Container.stories.tsx
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,27 @@ | ||
import React from 'react'; | ||
import { ComponentStory, ComponentMeta } from '@storybook/react'; | ||
import { Container } from '../components/Container'; | ||
|
||
export default { | ||
title: 'Wireframes/Container', | ||
component: Container, | ||
argTypes: { | ||
layout: { | ||
control: 'select', | ||
table: { | ||
defaultValue: { | ||
summary: 'plain', | ||
}, | ||
}, | ||
}, | ||
}, | ||
args: { | ||
layout: 'box', | ||
}, | ||
} as ComponentMeta<typeof Container>; | ||
|
||
const Template: ComponentStory<typeof Container> = (args) => <Container {...args} />; | ||
|
||
export const ContainerStory = Template.bind({}); | ||
|
||
ContainerStory.storyName = 'Container'; |