From 050094c991924c37697cdaea0745d953058a5373 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Sat, 8 Feb 2025 16:16:32 +0100 Subject: [PATCH] Update styling of "manga open source" button --- .../components/buttons/CustomButtonIcon.tsx | 29 +++++++++++++++++++ src/modules/manga/components/MangaDetails.tsx | 9 ++---- .../ReaderNavBarDesktopNextPreviousButton.tsx | 13 +++------ .../ReaderNavBarDesktopPageScale.tsx | 8 ++--- 4 files changed, 40 insertions(+), 19 deletions(-) create mode 100644 src/modules/core/components/buttons/CustomButtonIcon.tsx diff --git a/src/modules/core/components/buttons/CustomButtonIcon.tsx b/src/modules/core/components/buttons/CustomButtonIcon.tsx new file mode 100644 index 00000000..1ca07fd6 --- /dev/null +++ b/src/modules/core/components/buttons/CustomButtonIcon.tsx @@ -0,0 +1,29 @@ +/* + * 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 Button, { ButtonProps } from '@mui/material/Button'; +import { ForwardedRef, forwardRef } from 'react'; + +export const CustomButtonIcon = forwardRef( + ( + { children, ...props }: ButtonProps, + ref: ForwardedRef, + ) => ( + + ), +); diff --git a/src/modules/manga/components/MangaDetails.tsx b/src/modules/manga/components/MangaDetails.tsx index 7a7a5582..37b79c06 100644 --- a/src/modules/manga/components/MangaDetails.tsx +++ b/src/modules/manga/components/MangaDetails.tsx @@ -44,6 +44,7 @@ import { MANGA_COVER_ASPECT_RATIO, statusToTranslationKey } from '@/modules/mang import { MangaThumbnailInfo, MangaTrackRecordInfo } from '@/modules/manga/Manga.types.ts'; import { TAppThemeContext, useAppThemeContext } from '@/modules/theme/contexts/AppThemeContext.tsx'; import { applyStyles } from '@/modules/core/utils/ApplyStyles.ts'; +import { CustomButtonIcon } from '@/modules/core/components/buttons/CustomButtonIcon.tsx'; const DetailsWrapper = styled('div')(({ theme }) => ({ display: 'flex', @@ -130,7 +131,7 @@ const OpenSourceButton = ({ url }: { url?: string | null }) => { return ( - { target="_blank" rel="noreferrer" variant="outlined" - sx={{ - minWidth: 'unset', - px: '10px', - }} > - + ); }; diff --git a/src/modules/reader/components/overlay/navigation/desktop/ReaderNavBarDesktopNextPreviousButton.tsx b/src/modules/reader/components/overlay/navigation/desktop/ReaderNavBarDesktopNextPreviousButton.tsx index 64ff1a73..f935224b 100644 --- a/src/modules/reader/components/overlay/navigation/desktop/ReaderNavBarDesktopNextPreviousButton.tsx +++ b/src/modules/reader/components/overlay/navigation/desktop/ReaderNavBarDesktopNextPreviousButton.tsx @@ -10,25 +10,20 @@ import { ComponentProps } from 'react'; import KeyboardArrowLeftIcon from '@mui/icons-material/KeyboardArrowLeft'; import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight'; import { CustomTooltip } from '@/modules/core/components/CustomTooltip.tsx'; -import { CustomButton } from '@/modules/core/components/buttons/CustomButton.tsx'; +import { CustomButtonIcon } from '@/modules/core/components/buttons/CustomButtonIcon.tsx'; export const ReaderNavBarDesktopNextPreviousButton = ({ title, type, disabled, ...customIconButtonProps -}: Omit, 'children'> & { +}: Omit, 'children'> & { title: string; type: 'previous' | 'next'; }) => ( - + {type === 'previous' ? : } - + ); diff --git a/src/modules/reader/components/overlay/navigation/desktop/quick-settings/ReaderNavBarDesktopPageScale.tsx b/src/modules/reader/components/overlay/navigation/desktop/quick-settings/ReaderNavBarDesktopPageScale.tsx index d6ea405c..3c54bd08 100644 --- a/src/modules/reader/components/overlay/navigation/desktop/quick-settings/ReaderNavBarDesktopPageScale.tsx +++ b/src/modules/reader/components/overlay/navigation/desktop/quick-settings/ReaderNavBarDesktopPageScale.tsx @@ -10,7 +10,6 @@ import Stack from '@mui/material/Stack'; import { useTranslation } from 'react-i18next'; import FitScreenIcon from '@mui/icons-material/FitScreen'; import { CustomTooltip } from '@/modules/core/components/CustomTooltip.tsx'; -import { CustomButton } from '@/modules/core/components/buttons/CustomButton.tsx'; import { ValueRotationButton } from '@/modules/core/components/buttons/ValueRotationButton.tsx'; import { IReaderSettings, @@ -23,6 +22,7 @@ import { READER_PAGE_SCALE_MODE_VALUES, } from '@/modules/reader/constants/ReaderSettings.constants.tsx'; import { MultiValueButtonDefaultableProps } from '@/modules/core/Core.types.ts'; +import { CustomButtonIcon } from '@/modules/core/components/buttons/CustomButtonIcon.tsx'; export const ReaderNavBarDesktopPageScale = ({ pageScaleMode, @@ -52,14 +52,14 @@ export const ReaderNavBarDesktopPageScale = ({ /> {READER_PAGE_SCALE_MODE_TO_SCALING_ALLOWED[pageScaleMode.value] && ( - updateSetting('shouldStretchPage', !shouldStretchPage.value)} - sx={{ minWidth: 0 }} + sx={{ px: undefined }} variant="contained" color={shouldStretchPage.value ? 'secondary' : 'primary'} > - + )}