Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs(web-react, web): Add Text demo #DS-911 #1064

Merged
merged 2 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>,
);
2 changes: 1 addition & 1 deletion packages/web-react/src/constants/dictionaries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ export const Sizes = {
} as const;

export const SizesExtended = {
...Sizes,
XSMALL: 'xsmall',
...Sizes,
XLARGE: 'xlarge',
} as const;

Expand Down
28 changes: 16 additions & 12 deletions packages/web/src/scss/helpers/text/index.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
{{#> layout/plain }}

<section class="docs-Section">

<h2 class="docs-Heading">Truncate</h2>

<div class="docs-Stack docs-Stack--start">

<h2 class="docs-Heading">Text</h2>
<div style="width: 400px">
<p class="text-truncate">
This is a truncated single-line text.
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
</p>
<p class="text-truncate-multiline">
This is a truncated multi-line text.
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aliquam at excepturi laudantium magnam mollitia
perferendis reprehenderit, voluptate. Cum delectus dicta ducimus eligendi excepturi natus perferendis
provident unde. Eveniet, iste, molestiae?
</p>
</div>

<div style="width: 400px">
<p class="text-truncate">
This is a truncated single-line text.
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
</p>
<p class="text-truncate-multiline">
This is a truncated multi-line text.
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aliquam at excepturi laudantium magnam mollitia
perferendis reprehenderit, voluptate. Cum delectus dicta ducimus eligendi excepturi natus perferendis
provident unde. Eveniet, iste, molestiae?
</p>
</div>

</section>
Expand Down