File tree Expand file tree Collapse file tree 2 files changed +64
-2
lines changed
Expand file tree Collapse file tree 2 files changed +64
-2
lines changed Original file line number Diff line number Diff line change @@ -9,8 +9,6 @@ if (!commitMsgFile) {
99}
1010
1111try {
12- const commitMsg = fs . readFileSync ( commitMsgFile , 'utf8' ) . trim ( ) ;
13-
1412 // Use the locally installed commitlint
1513 try {
1614 execSync ( `npx commitlint --edit "${ commitMsgFile } "` , { stdio : 'inherit' } ) ;
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+
3+ const CustomSlider = ( {
4+ label,
5+ value,
6+ min = 0 ,
7+ max = 100 ,
8+ step = 1 ,
9+ onChange,
10+ className = '' ,
11+ variant = 'default' , // 'default' | 'brutalist'
12+ } ) => {
13+ const percentage = ( ( value - min ) / ( max - min ) ) * 100 ;
14+
15+ return (
16+ < div className = { `flex flex-col gap-2 w-full ${ className } ` } >
17+ { label && (
18+ < div className = "flex justify-between items-end" >
19+ < label className = "font-mono text-[10px] uppercase tracking-widest text-gray-500 font-bold" >
20+ { label }
21+ </ label >
22+ < span className = "font-mono text-xs text-emerald-500 font-bold" >
23+ { value }
24+ </ span >
25+ </ div >
26+ ) }
27+
28+ < div className = "relative w-full h-6 flex items-center group" >
29+ { /* Track Background */ }
30+ < div className = "absolute w-full h-1 bg-white/10 rounded-sm overflow-hidden" >
31+ { /* Filled Track */ }
32+ < div
33+ className = "h-full bg-emerald-500 transition-all duration-75 ease-out"
34+ style = { { width : `${ percentage } %` } }
35+ />
36+ </ div >
37+
38+ { /* Input */ }
39+ < input
40+ type = "range"
41+ min = { min }
42+ max = { max }
43+ step = { step }
44+ value = { value }
45+ onChange = { ( e ) => onChange ( Number ( e . target . value ) ) }
46+ className = "absolute w-full h-full opacity-0 cursor-pointer z-10"
47+ />
48+
49+ { /* Custom Thumb (Visual only, follows percentage) */ }
50+ < div
51+ className = "absolute h-4 w-4 bg-[#050505] border-2 border-emerald-500 rounded-sm pointer-events-none transition-all duration-75 ease-out group-hover:scale-110 group-active:scale-95"
52+ style = { {
53+ left : `calc(${ percentage } % - 8px)` ,
54+ } }
55+ >
56+ { /* Inner dot */ }
57+ < div className = "absolute inset-1 bg-emerald-500 opacity-0 group-hover:opacity-100 transition-opacity" />
58+ </ div >
59+ </ div >
60+ </ div >
61+ ) ;
62+ } ;
63+
64+ export default CustomSlider ;
You can’t perform that action at this time.
0 commit comments