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 Pill demo #DS-904 #1061

Merged
merged 2 commits into from
Sep 20, 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/Pill/demo/Pill.tsx

This file was deleted.

40 changes: 17 additions & 23 deletions packages/web-react/src/components/Pill/demo/PillColors.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
import React from 'react';
import { ActionColors, EmotionColors } from '../../../constants';
import Pill from '../Pill';

// @see: https://github.com/storybookjs/storybook/issues/8104#issuecomment-932310244
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const Story = (props: unknown) => (
<>
<div className="mb-500">
<Pill color="primary">3</Pill>
<Pill color="secondary">3</Pill>
<Pill color="tertiary">3</Pill>
<Pill color="inverted">3</Pill>
</div>
<div className="mb-500">
<Pill color="selected">333</Pill>
<Pill color="unselected">333</Pill>
</div>
<div>
<Pill color="success">3</Pill>
<Pill color="informative">3</Pill>
<Pill color="warning">3</Pill>
<Pill color="danger">3</Pill>
</div>
</>
);
const PillColors = () => {
const actionColors = Object.values(ActionColors);
const emotionColors = Object.values(EmotionColors);
const colors = [...actionColors, 'selected', 'unselected', ...emotionColors];

export default Story;
return (
<>
{colors.map((color) => (
<Pill key={color} color={color}>
3
</Pill>
))}
</>
);
};

export default PillColors;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from 'react';
import Pill from '../Pill';

const PillLongText = () => <Pill>333</Pill>;

export default PillLongText;
8 changes: 4 additions & 4 deletions packages/web-react/src/components/Pill/demo/index.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import DocsSection from '../../../../docs/DocsSections';
import Pill from './Pill';
import PillColors from './PillColors';
import PillLongText from './PillLongText';

ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
<React.StrictMode>
<DocsSection title="Default">
<Pill {...Pill.args} />
</DocsSection>
<DocsSection title="Colors">
<PillColors />
</DocsSection>
<DocsSection title="Long Text">
<PillLongText />
</DocsSection>
</React.StrictMode>,
);
48 changes: 32 additions & 16 deletions packages/web/src/scss/components/Pill/index.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,36 @@
{{#> layout/plain }}

<div class="mb-500">
<span class="Pill Pill--primary">3</span>
<span class="Pill Pill--secondary">3</span>
<span class="Pill Pill--tertiary">3</span>
<span class="Pill Pill--inverted">3</span>
</div>
<div class="mb-500">
<span class="Pill Pill--selected">333</span>
<span class="Pill Pill--unselected">333</span>
</div>
<div>
<span class="Pill Pill--success">3</span>
<span class="Pill Pill--informative">3</span>
<span class="Pill Pill--warning">3</span>
<span class="Pill Pill--danger">3</span>
</div>
<section class="docs-Section">

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

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

<span class="Pill Pill--primary">3</span>
<span class="Pill Pill--secondary">3</span>
<span class="Pill Pill--tertiary">3</span>
<span class="Pill Pill--inverted">3</span>
<span class="Pill Pill--selected">3</span>
<span class="Pill Pill--unselected">3</span>
<span class="Pill Pill--success">3</span>
<span class="Pill Pill--informative">3</span>
<span class="Pill Pill--warning">3</span>
<span class="Pill Pill--danger">3</span>

</div>

</section>

<section class="docs-Section">

<h2 class="docs-Heading">Long Text</h2>

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

<span class="Pill Pill--selected">333</span>

</div>

</section>

{{/layout/plain }}