frontend: add a small formatter for values
This might bit me in the ass, but for now it'll do
Parents:
0cf854c1 file(s) changed
- frontend/components/ui/ScaleSlider.tsx +3 -1
frontend/components/ui/ScaleSlider.tsx
@@ -15,6 +15,7 @@ interface ScaleSliderProps {
15 15 label: string;
16 16 value: number;
17 17 onValueChange: (value: number) => void;
18 + onValueFormat?: (value: number) => string;
18 19 min?: number;
19 20 max?: number;
20 21 step?: number;
@@ -30,6 +31,7 @@ export const ScaleSlider: React.FC<ScaleSliderProps> = ({
30 31 label,
31 32 value,
32 33 onValueChange,
34 + onValueFormat,
33 35 min = 0,
34 36 max = 10,
35 37 step = 1,
@@ -73,7 +75,7 @@ <Text style={[
73 75 isRich ? styles.valueRich : styles.valueCompact,
74 76 { color: textColor },
75 77 ]}>
76 - {valueDisplay}
78 + {(onValueFormat ? onValueFormat(valueDisplay) : valueDisplay)}
77 79 </Text>
78 80 </View>
79 81