commit 8a6e70ec50aaec0d0885a4c85950a086c544e922
parent f4e5ed9e9e6973f5c21b347321fe6d6531414960
Author: Sebastian <sebasjm@gmail.com>
Date: Thu, 24 Jun 2021 13:56:51 -0300
h collide
Diffstat:
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/packages/frontend/src/components/picker/DurationPicker.tsx b/packages/frontend/src/components/picker/DurationPicker.tsx
@@ -35,36 +35,36 @@ export interface Props {
// inspiration taken from https://github.com/flurmbo/react-duration-picker
export function DurationPicker({ days, hours, minutes, seconds, onChange, value }: Props): VNode {
- const s = 1000
- const m = s * 60
- const h = m * 60
- const d = h * 24
+ const ss = 1000
+ const ms = ss * 60
+ const hs = ms * 60
+ const ds = hs * 24
const i18n = useTranslator()
return <div class="rdp-picker">
{days && <DurationColumn unit={i18n`days`} max={99}
- value={Math.floor(value / d)}
- onDecrease={value >= d ? () => onChange(value - d) : undefined}
- onIncrease={value < 99 * d ? () => onChange(value + d) : undefined}
- onChange={diff => onChange(value + diff * d)}
+ value={Math.floor(value / ds)}
+ onDecrease={value >= ds ? () => onChange(value - ds) : undefined}
+ onIncrease={value < 99 * ds ? () => onChange(value + ds) : undefined}
+ onChange={diff => onChange(value + diff * ds)}
/>}
{hours && <DurationColumn unit={i18n`hours`} max={23} min={1}
- value={Math.floor(value / h) % 24}
- onDecrease={value >= h ? () => onChange(value - h) : undefined}
- onIncrease={value < 99 * d ? () => onChange(value + h) : undefined}
- onChange={diff => onChange(value + diff * h)}
+ value={Math.floor(value / hs) % 24}
+ onDecrease={value >= hs ? () => onChange(value - hs) : undefined}
+ onIncrease={value < 99 * ds ? () => onChange(value + hs) : undefined}
+ onChange={diff => onChange(value + diff * hs)}
/>}
{minutes && <DurationColumn unit={i18n`minutes`} max={59} min={1}
- value={Math.floor(value / m) % 60}
- onDecrease={value >= m ? () => onChange(value - m) : undefined}
- onIncrease={value < 99 * d ? () => onChange(value + m) : undefined}
- onChange={diff => onChange(value + diff * m)}
+ value={Math.floor(value / ms) % 60}
+ onDecrease={value >= ms ? () => onChange(value - ms) : undefined}
+ onIncrease={value < 99 * ds ? () => onChange(value + ms) : undefined}
+ onChange={diff => onChange(value + diff * ms)}
/>}
{seconds && <DurationColumn unit={i18n`seconds`} max={59}
- value={Math.floor(value / s) % 60}
- onDecrease={value >= s ? () => onChange(value - s) : undefined}
- onIncrease={value < 99 * d ? () => onChange(value + s) : undefined}
- onChange={diff => onChange(value + diff * s)}
+ value={Math.floor(value / ss) % 60}
+ onDecrease={value >= ss ? () => onChange(value - ss) : undefined}
+ onIncrease={value < 99 * ds ? () => onChange(value + ss) : undefined}
+ onChange={diff => onChange(value + diff * ss)}
/>}
</div>
}