diff --git a/components/Slider/index.scss b/components/Slider/index.scss new file mode 100644 index 00000000..392fded7 --- /dev/null +++ b/components/Slider/index.scss @@ -0,0 +1,42 @@ +.Slider { + position: relative; + display: flex; + align-items: center; + user-select: none; + touch-action: none; + width: $unit-20x; + height: 20px; + + .SliderTrack { + background-color: var(--button-bg); + position: relative; + flex-grow: 1; + border-radius: 9999px; + height: 3px; + } +} + +.SliderRange { + position: absolute; + background-color: var(--accent-blue); + border-radius: 9999px; + height: 100%; +} + +.SliderThumb { + display: block; + width: 20px; + height: 20px; + background-color: white; + box-shadow: 0 2px 10px var(--button-bg); + border-radius: 10px; + + &:hover { + background-color: darken(white, 10%); + } + + &:focus { + outline: none; + box-shadow: 0 0 0 5px rgba($accent--blue--light, 0.6); + } +} diff --git a/components/Slider/index.tsx b/components/Slider/index.tsx new file mode 100644 index 00000000..6bab8a88 --- /dev/null +++ b/components/Slider/index.tsx @@ -0,0 +1,30 @@ +import React from 'react' +import * as SliderPrimitive from '@radix-ui/react-slider' +import type { SliderProps } from '@radix-ui/react-slider' +import classNames from 'classnames' + +import './index.scss' + +interface Props {} + +const Slider = React.forwardRef( + (props, forwardedRef) => { + const value = props.value || props.defaultValue + + return ( + + + + + + + + ) + } +) + +export default Slider