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 Tag demo #DS-910 #1065

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
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>,
);
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
26 changes: 14 additions & 12 deletions packages/web/src/scss/components/Tag/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@
"small" "medium" "large" "xlarge" }}

<section class="docs-Section">
<div class="Grid Grid--cols-1 Grid--tablet--cols-3 Grid--desktop--cols-5">
{{#each @root.sizes as |size|}}
<div class="mb-700">
<h3 class="docs-Heading">Size {{size}}</h3>
{{#each @root.colors as |color|}}
<div class="my-600">
<span class="Tag Tag--{{color}} Tag--subtle Tag--{{size}}">Tag {{color}}</span>
</div>
<div class="my-600">
<span class="Tag Tag--{{color}} Tag--{{size}}">Tag {{color}}</span>
</div>
<h2 class="docs-Heading">Default</h2>
<div class="docs-Stack docs-Stack--stretch">
<div class="Grid Grid--cols-1 Grid--tablet--cols-3 Grid--desktop--cols-5">
{{#each @root.sizes as |size|}}
<section class="docs-Section">
<h3 class="docs-Heading">Size {{size}}</h3>
<div class="docs-Stack docs-Stack--start">
{{#each @root.colors as |color|}}
<span class="Tag Tag--{{color}} Tag--subtle Tag--{{size}}">Tag {{color}}</span>
<span class="Tag Tag--{{color}} Tag--{{size}}">Tag {{color}}</span>
{{/each}}
</div>
</section>
{{/each}}
</div>
{{/each}}
</div>
</section>


{{/layout/plain }}