Skip to content

Commit

Permalink
Docs(web-react): Add Text demo #DS-911
Browse files Browse the repository at this point in the history
- Text demo in web-react is now same as demo in web and web-twig
  • Loading branch information
pavelklibani committed Sep 21, 2023
1 parent cce1910 commit 160142d
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 101 deletions.
14 changes: 0 additions & 14 deletions packages/web-react/src/components/Text/demo/Text.tsx

This file was deleted.

This file was deleted.

6 changes: 6 additions & 0 deletions packages/web-react/src/components/Text/demo/TextDefault.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from 'react';
import Text from '../Text';

const TextDefault = () => <Text>Text</Text>;

export default TextDefault;
12 changes: 5 additions & 7 deletions packages/web-react/src/components/Text/demo/TextEmphasis.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import React from 'react';
import Text from '../Text';

// @see: https://github.com/storybookjs/storybook/issues/8104#issuecomment-932310244
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const Story = (props: unknown) => (
const TextEmphasis = () => (
<>
<Text>Body Medium Text Regular</Text>
<Text emphasis="bold">Body Medium Text Bold</Text>
<Text emphasis="italic">Body Medium Text Italic</Text>
<Text>Text regular</Text>
<Text emphasis="bold">Text bold</Text>
<Text emphasis="italic">Text italic</Text>
</>
);

export default Story;
export default TextEmphasis;
27 changes: 15 additions & 12 deletions packages/web-react/src/components/Text/demo/TextSizes.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import React from 'react';
import { SizesExtended } from '../../../constants';
import Text from '../Text';

// @see: https://github.com/storybookjs/storybook/issues/8104#issuecomment-932310244
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const Story = (props: unknown) => (
<>
<Text size="xsmall">Body XSmall Text Regular</Text>
<Text size="small">Body Small Text Regular</Text>
<Text size="medium">Body Medium Text Regular</Text>
<Text size="large">Body Large Text Regular</Text>
<Text size="xlarge">Body XLarge Text Regular</Text>
</>
);
const TextSizes = () => {
const sizes = Object.values(SizesExtended);

export default Story;
return (
<>
{sizes.map((size) => (
<Text key={size} size={size}>
Text {size}
</Text>
))}
</>
);
};

export default TextSizes;
32 changes: 10 additions & 22 deletions packages/web-react/src/components/Text/demo/index.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,20 @@
// Because there is no `dist` directory during the CI run
/* eslint-disable import/no-extraneous-dependencies, import/extensions, import/no-unresolved */
import React from 'react';
import ReactDOM from 'react-dom/client';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment, import/extensions, import/no-unresolved
// @ts-ignore: No declaration file
import icons from '@lmc-eu/spirit-icons/dist/icons';
import { IconsProvider } from '../../../context';
import DocsSection from '../../../../docs/DocsSections';
import Text from './Text';
import TextDefault from './TextDefault';
import TextSizes from './TextSizes';
import TextEmphasis from './TextEmphasis';
import BodyTypography from './TextAllCombinations';

ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
<React.StrictMode>
<IconsProvider value={icons}>
<DocsSection title="Default">
<Text {...Text.args} />
</DocsSection>
<DocsSection title="Sizes">
<TextSizes />
</DocsSection>
<DocsSection title="Emphasis">
<TextEmphasis />
</DocsSection>
<DocsSection title="Body Typography">
<BodyTypography />
</DocsSection>
</IconsProvider>
<DocsSection title="Default">
<TextDefault />
</DocsSection>
<DocsSection title="Sizes">
<TextSizes />
</DocsSection>
<DocsSection title="Emphasis">
<TextEmphasis />
</DocsSection>
</React.StrictMode>,
);

0 comments on commit 160142d

Please sign in to comment.