Files
suwayomi-material-you-webui/src/features/reader/overlay/progress-bar/components/ReaderProgressBarContainer.tsx

39 lines
1.6 KiB
TypeScript
Raw Normal View History

2024-09-28 03:24:16 +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 Stack from '@mui/material/Stack';
import { styled } from '@mui/material/styles';
2025-08-16 02:02:13 +02:00
import { IReaderSettings } from '@/features/reader/Reader.types.ts';
import { shouldForwardProp } from '@/base/utils/ShouldForwardProp.ts';
import { applyStyles } from '@/base/utils/ApplyStyles.ts';
2025-08-16 02:02:13 +02:00
import { getProgressBarPositionInfo } from '@/features/reader/overlay/progress-bar/ReaderProgressBar.utils.tsx';
2024-09-28 03:24:16 +02:00
type ReaderProgressBarContainerProps = Pick<IReaderSettings, 'progressBarPosition'>;
export const ReaderProgressBarContainer = styled(Stack, {
shouldForwardProp: shouldForwardProp<ReaderProgressBarContainerProps>(['progressBarPosition']),
})<ReaderProgressBarContainerProps>(({ theme, progressBarPosition }) => ({
position: 'fixed',
2024-11-04 18:00:35 +01:00
pointerEvents: 'all',
touchAction: 'none',
2024-09-28 03:24:16 +02:00
...applyStyles(getProgressBarPositionInfo(progressBarPosition).isHorizontal, {
justifyContent: 'flex-end',
bottom: 0,
right: 0,
}),
...applyStyles(getProgressBarPositionInfo(progressBarPosition).isVertical, {
top: 0,
bottom: 0,
}),
...applyStyles(getProgressBarPositionInfo(progressBarPosition).isLeft, {
alignItems: theme.direction === 'ltr' ? 'flex-start' : 'flex-end',
}),
...applyStyles(getProgressBarPositionInfo(progressBarPosition).isRight, {
alignItems: theme.direction === 'ltr' ? 'flex-end' : 'flex-start',
}),
}));