/* * Copyright (C) Contributors to the Suwayomi project * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import { useTranslation } from 'react-i18next'; import { CheckboxInput } from '@/features/core/components/inputs/CheckboxInput.tsx'; import { IReaderSettings } from '@/features/reader/types/Reader.types.ts'; import { SliderInput } from '@/features/core/components/inputs/SliderInput.tsx'; import { AUTO_SCROLL_SPEED, DEFAULT_READER_SETTINGS } from '@/features/reader/constants/ReaderSettings.constants.tsx'; export const ReaderSettingAutoScroll = ({ autoScroll, setAutoScroll, }: Pick & { setAutoScroll: (updatedAutoScroll: IReaderSettings['autoScroll'], commit: boolean) => void; }) => { const { t } = useTranslation(); return ( <> setAutoScroll({ ...autoScroll, smooth: checked }, true)} /> setAutoScroll({ ...autoScroll, value: DEFAULT_READER_SETTINGS.autoScroll.value }, true) } slotProps={{ slider: { defaultValue: DEFAULT_READER_SETTINGS.customFilter.saturate.value, value: autoScroll.value, ...AUTO_SCROLL_SPEED, onChange: (_, value) => { setAutoScroll({ ...autoScroll, value: value as number }, false); }, onChangeCommitted: (_, value) => { setAutoScroll({ ...autoScroll, value: value as number }, true); }, }, }} /> ); };