2024-10-03 04:02:59 +02:00
|
|
|
/*
|
|
|
|
|
* 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 { ValueRotationButton } from '@/modules/core/components/buttons/ValueRotationButton.tsx';
|
2024-11-04 18:00:35 +01:00
|
|
|
import { IReaderSettingsWithDefaultFlag, ReadingDirection } from '@/modules/reader/types/Reader.types.ts';
|
|
|
|
|
import {
|
|
|
|
|
READING_DIRECTION_VALUES,
|
|
|
|
|
READING_DIRECTION_VALUE_TO_DISPLAY_DATA,
|
|
|
|
|
} from '@/modules/reader/constants/ReaderSettings.constants.tsx';
|
|
|
|
|
import { MultiValueButtonDefaultableProps } from '@/modules/core/Core.types.ts';
|
2024-10-03 04:02:59 +02:00
|
|
|
|
|
|
|
|
export const ReaderNavBarDesktopReadingDirection = ({
|
|
|
|
|
readingDirection,
|
|
|
|
|
setReadingDirection,
|
2024-11-04 18:00:35 +01:00
|
|
|
...buttonSelectInputProps
|
|
|
|
|
}: Pick<IReaderSettingsWithDefaultFlag, 'readingDirection'> &
|
|
|
|
|
Pick<MultiValueButtonDefaultableProps<ReadingDirection>, 'isDefaultable' | 'onDefault'> & {
|
|
|
|
|
setReadingDirection: (readingDirection: ReadingDirection) => void;
|
|
|
|
|
}) => (
|
2024-10-03 04:02:59 +02:00
|
|
|
<ValueRotationButton
|
2024-11-04 18:00:35 +01:00
|
|
|
{...buttonSelectInputProps}
|
|
|
|
|
value={readingDirection.isDefault ? undefined : readingDirection.value}
|
2024-10-03 04:02:59 +02:00
|
|
|
values={READING_DIRECTION_VALUES}
|
|
|
|
|
setValue={setReadingDirection}
|
2024-11-04 18:00:35 +01:00
|
|
|
valueToDisplayData={READING_DIRECTION_VALUE_TO_DISPLAY_DATA}
|
|
|
|
|
defaultIcon={READING_DIRECTION_VALUE_TO_DISPLAY_DATA[readingDirection.value].icon}
|
2024-10-03 04:02:59 +02:00
|
|
|
/>
|
|
|
|
|
);
|