From 8a6ff5a2c15422badf0bc9c8166787dc23a71072 Mon Sep 17 00:00:00 2001
From: Yuval Adam <_@yuv.al>
Date: Mon, 23 Sep 2024 10:29:53 +0200
Subject: Move all geshem/ files to root

---
 app/components/Slider.tsx | 45 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 app/components/Slider.tsx

(limited to 'app/components/Slider.tsx')

diff --git a/app/components/Slider.tsx b/app/components/Slider.tsx
new file mode 100644
index 0000000..50223fc
--- /dev/null
+++ b/app/components/Slider.tsx
@@ -0,0 +1,45 @@
+import React from "react";
+import RcSlider, { SliderProps, SliderRef } from 'rc-slider/lib/Slider';
+import { PLAYBACK_SLOTS } from "./config";
+
+// use workaround from: https://github.com/react-component/slider/issues/835#issuecomment-1201805736
+const CustomSlider = RcSlider as React.ForwardRefExoticComponent<SliderProps<number> & React.RefAttributes<SliderRef>>;
+
+interface GeshemSliderProps {
+  playback?: string,
+  slider: number,
+  setSlider: React.Dispatch<React.SetStateAction<number>>
+}
+
+export function Slider({ playback, slider, setSlider }: GeshemSliderProps) {
+  const handleStyle = {
+    height: 40,
+    width: 40,
+    border: 0,
+    marginTop: -10,
+    boxShadow: ".5px .5px 2px 1px rgba(0,0,0,.32)"
+  };
+
+  const railStyle = {
+    height: 20,
+    backgroundColor: "#3498db"
+  };
+
+  const trackStyle = {
+    display: "none"
+  };
+
+  return (
+    <div id="slider">
+      <CustomSlider
+        min={0}
+        max={playback ? PLAYBACK_SLOTS : 9}
+        defaultValue={slider}
+        handleStyle={handleStyle}
+        railStyle={railStyle}
+        trackStyle={trackStyle}
+        onChange={val => setSlider(val)}
+      />
+    </div>
+  );
+}
-- 
cgit v1.3.1

