Skip to content

Commit

Permalink
Docs(web-react): Add Tag demo #DS-911
Browse files Browse the repository at this point in the history
- Tag demo in web-react is now same as demo in web and web-twig
  • Loading branch information
pavelklibani committed Sep 16, 2023
1 parent 4e1b5eb commit 70773b3
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 66 deletions.
2 changes: 1 addition & 1 deletion packages/web-react/docs/DocsSections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import DocsStack from './DocsStack';
interface DocsSectionProps {
children: ReactNode;
hasStack?: boolean;
stackAlignment?: 'start' | 'center' | 'end';
stackAlignment?: 'start' | 'center' | 'end' | 'stretch';
tag?: string;
title: string;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/web-react/docs/DocsStack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { ReactNode } from 'react';

interface DocsStackProps {
children: ReactNode;
stackAlignment?: 'start' | 'center' | 'end';
stackAlignment?: 'start' | 'center' | 'end' | 'stretch';
}

const DocsStack = ({ children, stackAlignment }: DocsStackProps) => {
Expand Down
14 changes: 0 additions & 14 deletions packages/web-react/src/components/Tag/demo/Tag.tsx

This file was deleted.

16 changes: 0 additions & 16 deletions packages/web-react/src/components/Tag/demo/TagColors.tsx

This file was deleted.

32 changes: 32 additions & 0 deletions packages/web-react/src/components/Tag/demo/TagDefault.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from 'react';
import DocsSection from '../../../../docs/DocsSections';
import { EmotionColors, SizesExtended } from '../../../constants';
import { Grid } from '../../Grid';
import { Tag } from '../Tag';

const TagDefault = () => {
const sizes = Object.values(SizesExtended);
const emotionColors = Object.values(EmotionColors);
const colors = ['neutral', ...emotionColors];

return (
<Grid cols={1} tablet={3} desktop={5}>
{sizes.map((size) => (
<DocsSection key={size} title={`Size ${size}`}>
{colors.map((color) => (
<>
<Tag color={color} size={size} isSubtle>
Tag {color}
</Tag>
<Tag color={color} size={size}>
Tag {color}
</Tag>
</>
))}
</DocsSection>
))}
</Grid>
);
};

export default TagDefault;
16 changes: 0 additions & 16 deletions packages/web-react/src/components/Tag/demo/TagSizes.tsx

This file was deleted.

22 changes: 4 additions & 18 deletions packages/web-react/src/components/Tag/demo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,13 @@
/* 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 Tag from './Tag';
import TagColors from './TagColors';
import TagSizes from './TagSizes';
import TagDefault from './TagDefault';

ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
<React.StrictMode>
<IconsProvider value={icons}>
<DocsSection title="Default">
<Tag {...Tag.args} />
</DocsSection>
<DocsSection title="Colors">
<TagColors />
</DocsSection>
<DocsSection title="Sizes">
<TagSizes />
</DocsSection>
</IconsProvider>
<DocsSection title="Default" stackAlignment="stretch">
<TagDefault />
</DocsSection>
</React.StrictMode>,
);

0 comments on commit 70773b3

Please sign in to comment.