diff --git a/package.json b/package.json index e32cacd..323d1ec 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "@radix-ui/react-avatar": "^1.1.2", "@radix-ui/react-dropdown-menu": "^2.1.4", "@radix-ui/react-select": "^2.1.4", + "@radix-ui/react-slider": "^1.2.2", "@radix-ui/react-slot": "^1.1.1", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", diff --git a/src/app/(main)/components/font-size-slider.tsx b/src/app/(main)/components/font-size-slider.tsx new file mode 100644 index 0000000..ce3fa3c --- /dev/null +++ b/src/app/(main)/components/font-size-slider.tsx @@ -0,0 +1,49 @@ +import { cn } from "@/lib/utils"; +import { Slider } from "@/components/ui/slider"; +import { useCodeEditorStore } from "@/store/useCodeEditorStore"; +import { MAX_FONT_SIZE, MIN_FONT_SIZE } from "@/constants/editor/options"; + +export default function FontSizeSlider() { + const skipInterval = 2; + const ticks = [...Array(MAX_FONT_SIZE - MIN_FONT_SIZE + 1)].map( + (_, i) => i + MIN_FONT_SIZE + ); + const { fontSize, setFontSize } = useCodeEditorStore(); + + const handleSliderChange = (value: number[]) => { + setFontSize(value[0]); + }; + + return ( +