Skip to content

Commit

Permalink
Docs(web-react): Add Pill demo #DS-904
Browse files Browse the repository at this point in the history
- Pill demo in web-react is now same as demo in web and web-twig
  • Loading branch information
pavelklibani committed Sep 18, 2023
1 parent 4e1b5eb commit 5eeedf3
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 41 deletions.
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, ...emotionColors];

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

export default PillColors;
6 changes: 6 additions & 0 deletions packages/web-react/src/components/Pill/demo/PillLongText.tsx
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>,
);

0 comments on commit 5eeedf3

Please sign in to comment.