Skip to content

Commit

Permalink
[base-ui][Slider] Refine demos (#39526)
Browse files Browse the repository at this point in the history
  • Loading branch information
zanivan authored Oct 20, 2023
1 parent dee1c9c commit e00fa56
Show file tree
Hide file tree
Showing 22 changed files with 256 additions and 174 deletions.
25 changes: 14 additions & 11 deletions docs/data/base/components/slider/DiscreteSlider.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const blue = {
300: '#66B2FF',
500: '#007FFF',
600: '#0072E5',
700: '#0059B3',
900: '#003A75',
};

Expand Down Expand Up @@ -67,10 +68,6 @@ const Slider = styled(BaseSlider)(
touch-action: none;
-webkit-tap-highlight-color: transparent;
&:hover {
opacity: 1;
}
&.${sliderClasses.disabled} {
pointer-events: none;
cursor: default;
Expand Down Expand Up @@ -109,20 +106,26 @@ const Slider = styled(BaseSlider)(
display: flex;
flex-direction: column-reverse;
:hover,
&.${sliderClasses.focusVisible} {
box-shadow: 0 0 0 0.25rem ${alpha(
theme.palette.mode === 'light' ? blue[400] : blue[300],
0.15,
&:hover{
box-shadow: 0 0 0 4px ${alpha(
theme.palette.mode === 'light' ? blue[200] : blue[300],
0.3,
)};
}
&.${sliderClasses.focusVisible} {
box-shadow: 0 0 0 4px ${theme.palette.mode === 'dark' ? blue[700] : blue[200]};
outline: none;
}
&.${sliderClasses.active} {
box-shadow: 0 0 0 0.25rem ${alpha(
box-shadow: 0 0 0 5px ${alpha(
theme.palette.mode === 'light' ? blue[200] : blue[300],
0.3,
0.5,
)};
outline: none;
}
}
& .${sliderClasses.mark} {
Expand Down
25 changes: 14 additions & 11 deletions docs/data/base/components/slider/DiscreteSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const blue = {
300: '#66B2FF',
500: '#007FFF',
600: '#0072E5',
700: '#0059B3',
900: '#003A75',
};

Expand Down Expand Up @@ -66,10 +67,6 @@ const Slider = styled(BaseSlider)(
touch-action: none;
-webkit-tap-highlight-color: transparent;
&:hover {
opacity: 1;
}
&.${sliderClasses.disabled} {
pointer-events: none;
cursor: default;
Expand Down Expand Up @@ -108,20 +105,26 @@ const Slider = styled(BaseSlider)(
display: flex;
flex-direction: column-reverse;
:hover,
&.${sliderClasses.focusVisible} {
box-shadow: 0 0 0 0.25rem ${alpha(
theme.palette.mode === 'light' ? blue[400] : blue[300],
0.15,
&:hover{
box-shadow: 0 0 0 4px ${alpha(
theme.palette.mode === 'light' ? blue[200] : blue[300],
0.3,
)};
}
&.${sliderClasses.focusVisible} {
box-shadow: 0 0 0 4px ${theme.palette.mode === 'dark' ? blue[700] : blue[200]};
outline: none;
}
&.${sliderClasses.active} {
box-shadow: 0 0 0 0.25rem ${alpha(
box-shadow: 0 0 0 5px ${alpha(
theme.palette.mode === 'light' ? blue[200] : blue[300],
0.3,
0.5,
)};
outline: none;
}
}
& .${sliderClasses.mark} {
Expand Down
24 changes: 13 additions & 11 deletions docs/data/base/components/slider/DiscreteSliderMarks.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const blue = {
300: '#66B2FF',
500: '#007FFF',
600: '#0072E5',
700: '#0059B3',
900: '#003A75',
};

Expand Down Expand Up @@ -73,10 +74,6 @@ const Slider = styled(BaseSlider)(
touch-action: none;
-webkit-tap-highlight-color: transparent;
&:hover {
opacity: 1;
}
&.${sliderClasses.disabled} {
pointer-events: none;
cursor: default;
Expand Down Expand Up @@ -113,19 +110,24 @@ const Slider = styled(BaseSlider)(
border: 3px solid currentColor;
background-color: #fff;
:hover,
&.${sliderClasses.focusVisible} {
box-shadow: 0 0 0 0.25rem ${alpha(
theme.palette.mode === 'light' ? blue[400] : blue[300],
0.15,
&:hover{
box-shadow: 0 0 0 4px ${alpha(
theme.palette.mode === 'light' ? blue[200] : blue[300],
0.3,
)};
}
&.${sliderClasses.focusVisible} {
box-shadow: 0 0 0 4px ${theme.palette.mode === 'dark' ? blue[700] : blue[200]};
outline: none;
}
&.${sliderClasses.active} {
box-shadow: 0 0 0 0.25rem ${alpha(
box-shadow: 0 0 0 5px ${alpha(
theme.palette.mode === 'light' ? blue[200] : blue[300],
0.3,
0.5,
)};
outline: none;
}
}
Expand Down
24 changes: 13 additions & 11 deletions docs/data/base/components/slider/DiscreteSliderMarks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const blue = {
300: '#66B2FF',
500: '#007FFF',
600: '#0072E5',
700: '#0059B3',
900: '#003A75',
};

Expand Down Expand Up @@ -73,10 +74,6 @@ const Slider = styled(BaseSlider)(
touch-action: none;
-webkit-tap-highlight-color: transparent;
&:hover {
opacity: 1;
}
&.${sliderClasses.disabled} {
pointer-events: none;
cursor: default;
Expand Down Expand Up @@ -113,19 +110,24 @@ const Slider = styled(BaseSlider)(
border: 3px solid currentColor;
background-color: #fff;
:hover,
&.${sliderClasses.focusVisible} {
box-shadow: 0 0 0 0.25rem ${alpha(
theme.palette.mode === 'light' ? blue[400] : blue[300],
0.15,
&:hover{
box-shadow: 0 0 0 4px ${alpha(
theme.palette.mode === 'light' ? blue[200] : blue[300],
0.3,
)};
}
&.${sliderClasses.focusVisible} {
box-shadow: 0 0 0 4px ${theme.palette.mode === 'dark' ? blue[700] : blue[200]};
outline: none;
}
&.${sliderClasses.active} {
box-shadow: 0 0 0 0.25rem ${alpha(
box-shadow: 0 0 0 5px ${alpha(
theme.palette.mode === 'light' ? blue[200] : blue[300],
0.3,
0.5,
)};
outline: none;
}
}
Expand Down
20 changes: 12 additions & 8 deletions docs/data/base/components/slider/DiscreteSliderValues.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const blue = {
300: '#66B2FF',
500: '#007FFF',
600: '#0072E5',
700: '#0059B3',
900: '#003A75',
};

Expand Down Expand Up @@ -74,10 +75,6 @@ const Slider = styled(BaseSlider)(
touch-action: none;
-webkit-tap-highlight-color: transparent;
&:hover {
opacity: 1;
}
&.${sliderClasses.disabled} {
pointer-events: none;
cursor: default;
Expand Down Expand Up @@ -115,17 +112,24 @@ const Slider = styled(BaseSlider)(
border: 3px solid currentColor;
background-color: #fff;
:hover,
&:hover{
box-shadow: 0 0 0 4px ${alpha(
theme.palette.mode === 'light' ? blue[200] : blue[300],
0.3,
)};
}
&.${sliderClasses.focusVisible} {
box-shadow: 0 0 0 4px ${theme.palette.mode === 'dark' ? blue[300] : blue[200]};
box-shadow: 0 0 0 4px ${theme.palette.mode === 'dark' ? blue[700] : blue[200]};
outline: none;
}
&.${sliderClasses.active} {
box-shadow: 0 0 0 0.25rem ${alpha(
box-shadow: 0 0 0 5px ${alpha(
theme.palette.mode === 'light' ? blue[200] : blue[300],
0.3,
0.5,
)};
outline: none;
}
}
Expand Down
20 changes: 12 additions & 8 deletions docs/data/base/components/slider/DiscreteSliderValues.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const blue = {
300: '#66B2FF',
500: '#007FFF',
600: '#0072E5',
700: '#0059B3',
900: '#003A75',
};

Expand Down Expand Up @@ -74,10 +75,6 @@ const Slider = styled(BaseSlider)(
touch-action: none;
-webkit-tap-highlight-color: transparent;
&:hover {
opacity: 1;
}
&.${sliderClasses.disabled} {
pointer-events: none;
cursor: default;
Expand Down Expand Up @@ -115,17 +112,24 @@ const Slider = styled(BaseSlider)(
border: 3px solid currentColor;
background-color: #fff;
:hover,
&:hover{
box-shadow: 0 0 0 4px ${alpha(
theme.palette.mode === 'light' ? blue[200] : blue[300],
0.3,
)};
}
&.${sliderClasses.focusVisible} {
box-shadow: 0 0 0 4px ${theme.palette.mode === 'dark' ? blue[300] : blue[200]};
box-shadow: 0 0 0 4px ${theme.palette.mode === 'dark' ? blue[700] : blue[200]};
outline: none;
}
&.${sliderClasses.active} {
box-shadow: 0 0 0 0.25rem ${alpha(
box-shadow: 0 0 0 5px ${alpha(
theme.palette.mode === 'light' ? blue[200] : blue[300],
0.3,
0.5,
)};
outline: none;
}
}
Expand Down
31 changes: 21 additions & 10 deletions docs/data/base/components/slider/LabeledValuesSlider.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const blue = {
300: '#66B2FF',
500: '#007FFF',
600: '#0072E5',
700: '#0059B3',
900: '#003A75',
};

Expand Down Expand Up @@ -57,9 +58,7 @@ const Slider = styled(BaseSlider)(
cursor: pointer;
touch-action: none;
-webkit-tap-highlight-color: transparent;
&:hover {
opacity: 1;
}
&.${sliderClasses.disabled} {
pointer-events: none;
cursor: default;
Expand Down Expand Up @@ -92,17 +91,31 @@ const Slider = styled(BaseSlider)(
outline: 0;
border: 3px solid currentColor;
background-color: #fff;
:hover,
&:hover{
box-shadow: 0 0 0 4px ${alpha(
theme.palette.mode === 'light' ? blue[200] : blue[300],
0.3,
)};
}
&.${sliderClasses.focusVisible} {
box-shadow: 0 0 0 4px ${theme.palette.mode === 'dark' ? blue[300] : blue[200]};
box-shadow: 0 0 0 4px ${theme.palette.mode === 'dark' ? blue[700] : blue[200]};
outline: none;
}
&.${sliderClasses.active} {
box-shadow: 0 0 0 5px ${alpha(
theme.palette.mode === 'light' ? blue[200] : blue[300],
0.5,
)};
outline: none;
}
& .label {
font-family: IBM Plex Sans;
font-weight: 600;
font-size: 14px;
background: unset;
background-color: ${theme.palette.mode === 'light' ? blue[500] : blue[300]};
background-color: ${theme.palette.mode === 'light' ? blue[600] : blue[900]};
width: 32px;
height: 32px;
padding: 0px;
Expand All @@ -125,10 +138,8 @@ const Slider = styled(BaseSlider)(
text-align: center;
}
&.${sliderClasses.active} {
box-shadow: 0 0 0 0.25rem ${alpha(
theme.palette.mode === 'light' ? blue[200] : blue[300],
0.3,
)};
box-shadow: 0 0 0 4px ${theme.palette.mode === 'dark' ? blue[600] : blue[300]};
outline: none;
}
}
`,
Expand Down
Loading

0 comments on commit e00fa56

Please sign in to comment.