mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-05-02 10:14:59 +00:00
fix(Player): disable value labels of subtitles settings if value is null
This commit is contained in:
parent
cce556e639
commit
e6e05573cb
1 changed files with 5 additions and 1 deletions
|
|
@ -45,6 +45,10 @@ const Stepper = ({ className, label, value, unit, step, min, max, disabled, onCh
|
||||||
return disabled || typeof value !== 'number' || (typeof max === 'number' && value >= max);
|
return disabled || typeof value !== 'number' || (typeof max === 'number' && value >= max);
|
||||||
}, [disabled, max, value]);
|
}, [disabled, max, value]);
|
||||||
|
|
||||||
|
const valueLabel = useMemo(() => {
|
||||||
|
return (disabled || typeof value !== 'number') ? '--' : `${value}${unit}`;
|
||||||
|
}, [disabled, value, unit]);
|
||||||
|
|
||||||
const updateValue = useCallback((delta: number) => {
|
const updateValue = useCallback((delta: number) => {
|
||||||
onChange(clamp(localValue.current + delta, min, max));
|
onChange(clamp(localValue.current + delta, min, max));
|
||||||
}, [onChange]);
|
}, [onChange]);
|
||||||
|
|
@ -88,7 +92,7 @@ const Stepper = ({ className, label, value, unit, step, min, max, disabled, onCh
|
||||||
<Icon className={styles['icon']} name={'remove'} />
|
<Icon className={styles['icon']} name={'remove'} />
|
||||||
</Button>
|
</Button>
|
||||||
<div className={styles['value']}>
|
<div className={styles['value']}>
|
||||||
{ disabled ? '--' : `${value}${unit}` }
|
{ valueLabel }
|
||||||
</div>
|
</div>
|
||||||
<Button
|
<Button
|
||||||
className={classNames(styles['button'], { 'disabled': increaseDisabled })}
|
className={classNames(styles['button'], { 'disabled': increaseDisabled })}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue