diff --git a/lib/components/Text/Text.tsx b/lib/components/Text/Text.tsx index 740de002d..7e86aa32b 100644 --- a/lib/components/Text/Text.tsx +++ b/lib/components/Text/Text.tsx @@ -16,11 +16,12 @@ export const Text: FunctionComponent = ({ variant = null, className = '', children, -}) => { - const cls = cx([styles.root, className], { - [styles.variantMobile]: !!variant && variant === EVariant.Mobile, - [styles.variantDesktop]: !!variant && variant === EVariant.Desktop, - }); - - return

; -}; +}) => ( +

+); diff --git a/lib/components/TextContainer/TextContainer.tsx b/lib/components/TextContainer/TextContainer.tsx new file mode 100644 index 000000000..8da81e158 --- /dev/null +++ b/lib/components/TextContainer/TextContainer.tsx @@ -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 = ({ + heading = null, + children, +}) => ( +

+ {!!heading &&
{heading}
} + {children} +
+); diff --git a/lib/components/TextContainer/index.ts b/lib/components/TextContainer/index.ts new file mode 100644 index 000000000..c953445b4 --- /dev/null +++ b/lib/components/TextContainer/index.ts @@ -0,0 +1 @@ +export { TextContainer } from './TextContainer'; diff --git a/lib/components/TextContainer/stories.tsx b/lib/components/TextContainer/stories.tsx new file mode 100644 index 000000000..37f07dbb7 --- /dev/null +++ b/lib/components/TextContainer/stories.tsx @@ -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 =>
{story()}
) + .add('default', () => ( + + Choose a credit pack + + To get started, choose a credit pack that will used for Auto + Top-Up. + + + )) + .add('with interaction', () => ( + + Reviews + + + }> + All of our reviews are from verified customers. + + )) + .add('with long title', () => ( + + Setup your personal settings + + + }> + All of our reviews are from verified customers. + + )) + .add('with no body text', () => ( + + Choose a credit pack + + )) + .add('with no title text', () => ( + + + To get started, choose a credit pack that will used for Auto + Top-Up. + + + )); diff --git a/lib/components/TextContainer/style.scss b/lib/components/TextContainer/style.scss new file mode 100644 index 000000000..7417eb52c --- /dev/null +++ b/lib/components/TextContainer/style.scss @@ -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; + } + } +}