-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(TextContainer): initial impl of a TextContainer cmp (#9)
- Loading branch information
Showing
5 changed files
with
122 additions
and
8 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,16 @@ | ||
import React, { FunctionComponent, ReactElement } from 'react'; | ||
import styles from './style.scss'; | ||
|
||
export interface IProps { | ||
heading?: ReactElement | null; | ||
} | ||
|
||
export const TextContainer: FunctionComponent<IProps> = ({ | ||
heading = null, | ||
children, | ||
}) => ( | ||
<article className={styles.root}> | ||
{!!heading && <header>{heading}</header>} | ||
{children} | ||
</article> | ||
); |
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 @@ | ||
export { TextContainer } from './TextContainer'; |
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,61 @@ | ||
import { storiesOf } from '@storybook/react'; | ||
import React from 'react'; | ||
import { Button, EButtonSize, EButtonVariant } from '../Button'; | ||
import { Heading } from '../Heading'; | ||
import { Text } from '../Text'; | ||
import { TextContainer } from './TextContainer'; | ||
|
||
storiesOf('Components|Type/TextContainer', module) | ||
.addDecorator(story => <div style={{ maxWidth: 512 }}>{story()}</div>) | ||
.add('default', () => ( | ||
<TextContainer> | ||
<Heading>Choose a credit pack</Heading> | ||
<Text> | ||
To get started, choose a credit pack that will used for Auto | ||
Top-Up. | ||
</Text> | ||
</TextContainer> | ||
)) | ||
.add('with interaction', () => ( | ||
<TextContainer | ||
heading={ | ||
<> | ||
<Heading>Reviews</Heading> | ||
<Button | ||
variant={EButtonVariant.Secondary} | ||
size={EButtonSize.Small}> | ||
Edit | ||
</Button> | ||
</> | ||
}> | ||
<Text>All of our reviews are from verified customers.</Text> | ||
</TextContainer> | ||
)) | ||
.add('with long title', () => ( | ||
<TextContainer | ||
heading={ | ||
<> | ||
<Heading>Setup your personal settings</Heading> | ||
<Button | ||
variant={EButtonVariant.Secondary} | ||
size={EButtonSize.Small}> | ||
Edit | ||
</Button> | ||
</> | ||
}> | ||
<Text>All of our reviews are from verified customers.</Text> | ||
</TextContainer> | ||
)) | ||
.add('with no body text', () => ( | ||
<TextContainer> | ||
<Heading>Choose a credit pack</Heading> | ||
</TextContainer> | ||
)) | ||
.add('with no title text', () => ( | ||
<TextContainer> | ||
<Text> | ||
To get started, choose a credit pack that will used for Auto | ||
Top-Up. | ||
</Text> | ||
</TextContainer> | ||
)); |
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,35 @@ | ||
.root { | ||
display: block; | ||
margin-bottom: var(--global--space--5); | ||
|
||
h1, | ||
h2, | ||
h3, | ||
h4, | ||
h5, | ||
h6, | ||
> header { | ||
display: block; | ||
|
||
~ * { | ||
display: block; | ||
padding-top: var(--global--space--2); | ||
} | ||
} | ||
|
||
header { | ||
display: flex; | ||
align-items: center; | ||
flex-direction: row; | ||
place-content: center space-between; | ||
|
||
> :last-child { | ||
flex-shrink: 0; | ||
margin-left: var(--global--space--4); | ||
} | ||
|
||
> * { | ||
display: block; | ||
} | ||
} | ||
} |