Update styling of "manga open source" button

This commit is contained in:
schroda
2025-02-08 16:16:32 +01:00
parent f633059083
commit 050094c991
4 changed files with 40 additions and 19 deletions

View File

@@ -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(
<C extends React.ElementType>(
{ children, ...props }: ButtonProps<C, { component?: C }>,
ref: ForwardedRef<HTMLButtonElement | null>,
) => (
<Button
ref={ref}
{...props}
sx={{
minWidth: 'unset',
px: '10px',
...props.sx,
}}
>
{children}
</Button>
),
);

View File

@@ -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 (
<CustomTooltip title={t('global.button.open_site')} disabled={!url}>
<CustomButton
<CustomButtonIcon
size="medium"
disabled={!url}
component={Link}
@@ -138,13 +139,9 @@ const OpenSourceButton = ({ url }: { url?: string | null }) => {
target="_blank"
rel="noreferrer"
variant="outlined"
sx={{
minWidth: 'unset',
px: '10px',
}}
>
<LaunchIcon />
</CustomButton>
</CustomButtonIcon>
</CustomTooltip>
);
};

View File

@@ -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<ComponentProps<typeof CustomButton>, 'children'> & {
}: Omit<ComponentProps<typeof CustomButtonIcon>, 'children'> & {
title: string;
type: 'previous' | 'next';
}) => (
<CustomTooltip title={title} disabled={disabled}>
<CustomButton
sx={{ minWidth: 0, px: 1, flexBasis: '15%' }}
variant="contained"
disabled={disabled}
{...customIconButtonProps}
>
<CustomButtonIcon sx={{ flexBasis: '15%' }} variant="contained" disabled={disabled} {...customIconButtonProps}>
{type === 'previous' ? <KeyboardArrowLeftIcon /> : <KeyboardArrowRightIcon />}
</CustomButton>
</CustomButtonIcon>
</CustomTooltip>
);

View File

@@ -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] && (
<CustomTooltip title={t('reader.settings.page_scale.stretch')}>
<CustomButton
<CustomButtonIcon
onClick={() => updateSetting('shouldStretchPage', !shouldStretchPage.value)}
sx={{ minWidth: 0 }}
sx={{ px: undefined }}
variant="contained"
color={shouldStretchPage.value ? 'secondary' : 'primary'}
>
<FitScreenIcon />
</CustomButton>
</CustomButtonIcon>
</CustomTooltip>
)}
</Stack>