Skip to content

Commit

Permalink
Created Slider component
Browse files Browse the repository at this point in the history
  • Loading branch information
colin-codegen[bot] authored Aug 21, 2023
1 parent 55dc790 commit 454e9cc
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/components/Slider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from 'react';

interface SliderProps {
value: number;
min?: number;
max?: number;
step?: number;
onChange: (value: number) => void;
}

const Slider: React.FC<SliderProps> = ({ value, min = 0, max = 100, step = 1, onChange }) => {
const handleSliderChange = (event: React.ChangeEvent<HTMLInputElement>) => {
onChange(Number(event.target.value));
};

return (
<div className="slider-container">
<input
type="range"
min={min}
max={max}
step={step}
value={value}
onChange={handleSliderChange}
className="slider"
/>
</div>
);
};

export default Slider;

0 comments on commit 454e9cc

Please sign in to comment.