Skip to content

Commit f942c9e

Browse files
authored
fix(ui5-slider): enhance storybook samples (#7460)
* fix(ui5-slider): enhance storybook samples * fix(ui5-slider): apply review comments
1 parent 52be839 commit f942c9e

File tree

2 files changed

+81
-42
lines changed

2 files changed

+81
-42
lines changed

packages/playground/_stories/main/RangeSlider/RangeSlider.stories.ts

Lines changed: 41 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { ifDefined } from "lit/directives/if-defined.js";
1313
const component = "ui5-range-slider";
1414

1515
export default {
16-
title: "Main/RangeSlider",
16+
title: "Main/Range Slider",
1717
component: "RangeSlider",
1818
parameters: {
1919
docs: {
@@ -35,38 +35,54 @@ const Template: UI5StoryArgs<RangeSlider, StoryArgsSlots> = (args) => html`
3535
?show-tooltip="${ifDefined(args.showTooltip)}"
3636
></ui5-range-slider>`;
3737

38-
export const BasicRangeSlider = Template.bind({});
39-
BasicRangeSlider.args = {
38+
export const Basic = Template.bind({});
39+
Basic.decorators = [
40+
(story) => {
41+
return html`
42+
<div class="wrapper" style="margin-top:1rem;">
43+
${story()}
44+
</div>
45+
`;
46+
}
47+
]
48+
Basic.args = {
49+
min: 0,
50+
max: 100,
51+
step: 5,
52+
disabled: false,
53+
showTooltip: false,
54+
showTickmarks: false,
55+
labelInterval: 0,
56+
startValue: 0,
4057
endValue: 20
4158
};
4259

43-
export const RangeSliderCustomValues = Template.bind({});
44-
RangeSliderCustomValues.args = {
45-
min: 100,
46-
max: 200,
47-
startValue: 120,
48-
endValue: 150
49-
};
50-
RangeSliderCustomValues.storyName = "Range Slider with Custom 'min', 'max', 'startValue' and 'endValue' Properties";
51-
52-
export const RangeSliderTooltip = Template.bind({});
53-
RangeSliderTooltip.args = {
60+
export const WithTooltips = Template.bind({});
61+
WithTooltips.decorators = [
62+
(story) => {
63+
return html`
64+
<div class="wrapper" style="margin-top:1rem;">
65+
${story()}
66+
</div>
67+
`;
68+
}
69+
]
70+
WithTooltips.args = {
5471
startValue: 3,
5572
endValue: 13,
5673
showTooltip: true
5774
};
58-
RangeSliderTooltip.storyName = "Range Slider with Tooltips";
59-
60-
export const RangeSliderTickmarksCustomStep = Template.bind({});
61-
RangeSliderTickmarksCustomStep.args = {
62-
step: 2,
63-
startValue: 12,
64-
endValue: 24,
65-
showTickmarks: true
66-
};
67-
RangeSliderTickmarksCustomStep.storyName = "Range Slider with Tickmarks and Custom Step";
6875

6976
export const RangeSliderTickmarksTooltipLabel = Template.bind({});
77+
RangeSliderTickmarksTooltipLabel.decorators = [
78+
(story) => {
79+
return html`
80+
<div class="wrapper" style="margin-top:1rem;">
81+
${story()}
82+
</div>
83+
`;
84+
}
85+
]
7086
RangeSliderTickmarksTooltipLabel.args = {
7187
min: 0,
7288
max: 112,
@@ -77,4 +93,4 @@ RangeSliderTickmarksTooltipLabel.args = {
7793
showTickmarks: true,
7894
showTooltip: true
7995
};
80-
RangeSliderTickmarksTooltipLabel.storyName = "Range Slider with Tooltips, Tickmarks and Labels";
96+
RangeSliderTickmarksTooltipLabel.storyName = "With Tooltips, Tickmarks and Labels";

packages/playground/_stories/main/Slider/Slider.stories.ts

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,30 +36,53 @@ const Template: UI5StoryArgs<Slider, StoryArgsSlots> = (args) => html`
3636
accessible-name="${ifDefined(args.accessibleName)}"
3737
></ui5-slider>`;
3838

39-
export const BasicSlider = Template.bind({});
39+
export const Basic = Template.bind({});
40+
Basic.decorators = [
41+
(story) => {
42+
return html`
43+
<div class="wrapper" style="margin-top:1rem;">
44+
${story()}
45+
</div>
46+
`;
47+
}
48+
]
49+
Basic.args = {
50+
min: 0,
51+
max: 100,
52+
step: 5,
53+
disabled: false,
54+
showTooltip: false,
55+
showTickmarks: false,
56+
labelInterval: 0
57+
};
4058

41-
export const SliderTooltip = Template.bind({});
42-
SliderTooltip.args = {
59+
export const WithTooltip = Template.bind({});
60+
WithTooltip.decorators = [
61+
(story) => {
62+
return html`
63+
<div class="wrapper" style="margin-top:1rem;">
64+
${story()}
65+
</div>
66+
`;
67+
}
68+
]
69+
WithTooltip.args = {
4370
min: 0,
4471
max: 20,
4572
showTooltip: true,
4673
labelInterval: 5
47-
4874
};
49-
SliderTooltip.storyName = "Slider with Tooltip";
50-
51-
export const DisabledTickmarksLabel = Template.bind({});
52-
DisabledTickmarksLabel.args = {
53-
min: 20,
54-
max: 100,
55-
labelInterval: 5,
56-
disabled: true,
57-
showTickmarks: true
58-
};
59-
DisabledTickmarksLabel.storyName = "Disabled Slider with Tickmarks and Labels";
60-
6175

6276
export const TickmarksLabelTooltip = Template.bind({});
77+
TickmarksLabelTooltip.decorators = [
78+
(story) => {
79+
return html`
80+
<div class="wrapper" style="margin-top:1rem;">
81+
${story()}
82+
</div>
83+
`;
84+
}
85+
]
6386
TickmarksLabelTooltip.args = {
6487
min: -20,
6588
max: 20,
@@ -69,4 +92,4 @@ TickmarksLabelTooltip.args = {
6992
labelInterval: 2,
7093
showTickmarks: true
7194
};
72-
TickmarksLabelTooltip.storyName = "Slider Tooltip, Tickmarks and Labels";
95+
TickmarksLabelTooltip.storyName = "With Tooltip, Tickmarks and Labels";

0 commit comments

Comments
 (0)