Skip to content

Commit 7a2c109

Browse files
committed
refactor Badge story
1 parent c04396d commit 7a2c109

File tree

2 files changed

+63
-35
lines changed

2 files changed

+63
-35
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import { Meta, Story, Canvas, ArgsTable } from '@storybook/addon-docs/blocks';
2+
import { Badge } from '@ui5/webcomponents-react/lib/Badge';
3+
import '@ui5/webcomponents-icons/dist/icons/employee.js';
4+
import { Icon } from '@ui5/webcomponents-react/lib/Icon';
5+
import { CSSProperties, Ref } from 'react';
6+
7+
import { createSelectArgTypes } from '@shared/stories/createSelectArgTypes';
8+
import { DocsHeader } from '@shared/stories/DocsHeader';
9+
10+
<Meta
11+
title="UI5 Web Components / Badge"
12+
component={Badge}
13+
argTypes={{
14+
...createSelectArgTypes({}),
15+
children: { control: 'text' },
16+
icon: { control: { disable: true } },
17+
slot: { control: { disable: true } },
18+
ref: { control: { disable: true } },
19+
style: {
20+
type: CSSProperties,
21+
description:
22+
'Element style which will be appended to the most outer element of a component. Use this prop carefully, some css properties might break the component.'
23+
},
24+
className: {
25+
type: 'string',
26+
description:
27+
'CSS Class Name which will be appended to the most outer element of a component. Use this prop carefully, overwriting CSS rules might break the component.'
28+
},
29+
tooltip: { type: 'string', description: 'A tooltip which will be shown on hover' }
30+
}}
31+
args={{
32+
children: 'Badge Text',
33+
icon: <Icon name="employee" />,
34+
style: {},
35+
className: '',
36+
tooltip: '',
37+
slot: '',
38+
ref: null
39+
}}
40+
/>
41+
42+
<DocsHeader />
43+
44+
<Canvas>
45+
<Story name="Default">
46+
{(args) => {
47+
return <Badge {...args} />;
48+
}}
49+
</Story>
50+
</Canvas>
51+
52+
<ArgsTable story="." />
53+
<div style={{fontFamily:'var(--sapFontFamily)', fontSize:'var(--sapFontSize)', color:'var(--sapTextColor)'}}>
54+
<h3>Usage Guidelines</h3>
55+
<ul>
56+
<li>If the text is longer than the width of the component, it doesn’t wrap, it shows ellipsis.</li>
57+
<li>
58+
When truncated, the full text is not visible, therefore, it’s recommended to make more space for longer texts to be
59+
fully displayed.
60+
</li>
61+
<li>Colors are not semantic and have no visual representation in High Contrast Black (sap_belize_hcb) theme.</li>
62+
</ul>
63+
</div>

packages/main/src/webComponents/Badge/Badge.stories.tsx

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)