Skip to content

Commit e76721c

Browse files
refactor(slider): ♻️ remove orientation from verticalSlider (#375)
refactor(slider): ♻️ remove orientation from verticalSlider
2 parents a4c37df + 448b7d7 commit e76721c

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

src/slider/stories/SliderSingleVertical.component.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@ export type SliderSingleVerticalProps = SliderBaseStateProps & {
2020
showTip?: boolean;
2121
};
2222

23-
export const SliderSingleVertical: React.FC<
24-
SliderSingleVerticalProps
25-
> = props => {
23+
export const SliderSingleVertical: React.FC<SliderSingleVerticalProps> = ({
24+
orientation = "vertical",
25+
...props
26+
}) => {
2627
const { label, showTip, ...rest } = props;
2728
const sliderLabel = `${label ? label : "Styled"} Slider`;
28-
const state = useSliderBaseState(props);
29+
const state = useSliderBaseState({ ...props, orientation });
2930
const slider = useSliderState({ ...rest, label: sliderLabel, state });
3031
const { getThumbValueLabel, getValuePercent, values } = state;
3132

@@ -52,7 +53,7 @@ export const SliderSingleVertical: React.FC<
5253
<Thumb
5354
index={0}
5455
state={state}
55-
orientation={props.orientation}
56+
orientation={orientation}
5657
isDisabled={props.isDisabled}
5758
trackRef={slider.trackRef}
5859
aria-label="Thumb"

src/slider/stories/SliderSingleVertical.stories.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,18 @@ export default {
3030
} as Meta;
3131

3232
export const Default: Story = {
33-
args: {
34-
orientation: "vertical",
35-
},
33+
args: {},
3634
};
3735

3836
export const ThumbTip: Story = {
3937
args: {
40-
orientation: "vertical",
4138
label: "Thumb Tipped",
4239
showTip: true,
4340
},
4441
};
4542

4643
export const MinMax: Story = {
4744
args: {
48-
orientation: "vertical",
4945
label: "Min Max",
5046
minValue: 20,
5147
maxValue: 80,
@@ -54,23 +50,20 @@ export const MinMax: Story = {
5450

5551
export const Step: Story = {
5652
args: {
57-
orientation: "vertical",
5853
label: "Stepped",
5954
step: 10,
6055
},
6156
};
6257

6358
export const DefaultValue: Story = {
6459
args: {
65-
orientation: "vertical",
6660
label: "Default Valued",
6761
defaultValue: [80],
6862
},
6963
};
7064

7165
export const FormatOptions: Story = {
7266
args: {
73-
orientation: "vertical",
7467
label: "Temperature Formatted",
7568
formatOptions: {
7669
style: "unit",
@@ -82,7 +75,6 @@ export const FormatOptions: Story = {
8275

8376
export const Disabled: Story = {
8477
args: {
85-
orientation: "vertical",
8678
label: "Disabled",
8779
isDisabled: true,
8880
},

0 commit comments

Comments
 (0)