Skip to content

Commit b98892b

Browse files
committed
refactor Switch main description + story
1 parent 666dfec commit b98892b

File tree

3 files changed

+51
-26
lines changed

3 files changed

+51
-26
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import { Meta, Story, Canvas, ArgsTable } from '@storybook/addon-docs/blocks';
2+
import { Switch } from '@ui5/webcomponents-react/lib/Switch';
3+
import { CSSProperties, Ref } from 'react';
4+
5+
import { createSelectArgTypes } from '@shared/stories/createSelectArgTypes';
6+
import { DocsHeader } from '@shared/stories/DocsHeader';
7+
8+
<Meta
9+
title="UI5 Web Components / Switch"
10+
component={Switch}
11+
argTypes={{
12+
...createSelectArgTypes({}),
13+
slot: { control: { disable: true } },
14+
ref: { control: { disable: true } },
15+
style: {
16+
type: CSSProperties,
17+
description:
18+
'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.'
19+
},
20+
className: {
21+
type: 'string',
22+
description:
23+
'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.'
24+
},
25+
tooltip: { type: 'string', description: 'A tooltip which will be shown on hover' }
26+
}}
27+
args={{
28+
style: {},
29+
className: '',
30+
tooltip: '',
31+
slot: '',
32+
ref: null
33+
}}
34+
/>
35+
36+
<DocsHeader />
37+
38+
<Canvas>
39+
<Story name="Default">
40+
{(args) => {
41+
return <Switch {...args} />;
42+
}}
43+
</Story>
44+
</Canvas>
45+
46+
<ArgsTable story="." />
47+
<div style={{fontFamily:'var(--sapFontFamily)', fontSize:'var(--sapFontSize)', color:'var(--sapTextColor)'}}>
48+
<h3>Keyboard Handling</h3>
49+
The state can be changed by pressing the Space and Enter keys.
50+
</div>

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

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

packages/main/src/webComponents/Switch/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export interface SwitchPropTypes extends Omit<WithWebComponentPropTypes, 'onChan
3535
* The <code>Switch</code> component is used for changing between binary states. <br />
3636
The component can display texts, that will be switched, based on the component state, via the <code>textOn</code> and
3737
<code>textOff</code> properties, but texts longer than 3 letters will be cutted off. <br />
38-
However, users are able to customize the width of <code>Switch</code> with pure CSS (&lt;Switch style="width: 200px">),
38+
However, users are able to customize the width of <code>Switch</code> with pure CSS (&lt;Switch style={{width: "200px"}}/>),
3939
and set widths, depending on the texts they would use. <br />
4040
Note: the component would not automatically stretch to fit the whole text width.
4141

0 commit comments

Comments
 (0)