[Refactor] Improve clarity of slider logic by inverting label filtering.

This commit is contained in:
Sakamoto Shiina
2025-11-06 13:04:35 +09:00
parent c76b2981c6
commit e23bf223ae
2 changed files with 5 additions and 8 deletions

View File

@@ -212,16 +212,13 @@ export const useSliderLogic = ({
min,
max,
step = 1,
hidden_label_values
show_label_values
}) => {
const [ui_value, setUiValue] = useState(current_value.data);
const labelFormatter = useCallback((value) => {
if (hidden_label_values && hidden_label_values.includes(value)) {
return "";
}
return value;
}, [hidden_label_values]);
return (show_label_values && show_label_values.includes(value)) ? value : "";
}, [show_label_values]);
const marks = useMemo(() => {
return createMarks(min, max, step, labelFormatter);