Update styling of "manga open source" button
This commit is contained in:
29
src/modules/core/components/buttons/CustomButtonIcon.tsx
Normal file
29
src/modules/core/components/buttons/CustomButtonIcon.tsx
Normal 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>
|
||||||
|
),
|
||||||
|
);
|
||||||
@@ -44,6 +44,7 @@ import { MANGA_COVER_ASPECT_RATIO, statusToTranslationKey } from '@/modules/mang
|
|||||||
import { MangaThumbnailInfo, MangaTrackRecordInfo } from '@/modules/manga/Manga.types.ts';
|
import { MangaThumbnailInfo, MangaTrackRecordInfo } from '@/modules/manga/Manga.types.ts';
|
||||||
import { TAppThemeContext, useAppThemeContext } from '@/modules/theme/contexts/AppThemeContext.tsx';
|
import { TAppThemeContext, useAppThemeContext } from '@/modules/theme/contexts/AppThemeContext.tsx';
|
||||||
import { applyStyles } from '@/modules/core/utils/ApplyStyles.ts';
|
import { applyStyles } from '@/modules/core/utils/ApplyStyles.ts';
|
||||||
|
import { CustomButtonIcon } from '@/modules/core/components/buttons/CustomButtonIcon.tsx';
|
||||||
|
|
||||||
const DetailsWrapper = styled('div')(({ theme }) => ({
|
const DetailsWrapper = styled('div')(({ theme }) => ({
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@@ -130,7 +131,7 @@ const OpenSourceButton = ({ url }: { url?: string | null }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<CustomTooltip title={t('global.button.open_site')} disabled={!url}>
|
<CustomTooltip title={t('global.button.open_site')} disabled={!url}>
|
||||||
<CustomButton
|
<CustomButtonIcon
|
||||||
size="medium"
|
size="medium"
|
||||||
disabled={!url}
|
disabled={!url}
|
||||||
component={Link}
|
component={Link}
|
||||||
@@ -138,13 +139,9 @@ const OpenSourceButton = ({ url }: { url?: string | null }) => {
|
|||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
sx={{
|
|
||||||
minWidth: 'unset',
|
|
||||||
px: '10px',
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<LaunchIcon />
|
<LaunchIcon />
|
||||||
</CustomButton>
|
</CustomButtonIcon>
|
||||||
</CustomTooltip>
|
</CustomTooltip>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,25 +10,20 @@ import { ComponentProps } from 'react';
|
|||||||
import KeyboardArrowLeftIcon from '@mui/icons-material/KeyboardArrowLeft';
|
import KeyboardArrowLeftIcon from '@mui/icons-material/KeyboardArrowLeft';
|
||||||
import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';
|
import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';
|
||||||
import { CustomTooltip } from '@/modules/core/components/CustomTooltip.tsx';
|
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 = ({
|
export const ReaderNavBarDesktopNextPreviousButton = ({
|
||||||
title,
|
title,
|
||||||
type,
|
type,
|
||||||
disabled,
|
disabled,
|
||||||
...customIconButtonProps
|
...customIconButtonProps
|
||||||
}: Omit<ComponentProps<typeof CustomButton>, 'children'> & {
|
}: Omit<ComponentProps<typeof CustomButtonIcon>, 'children'> & {
|
||||||
title: string;
|
title: string;
|
||||||
type: 'previous' | 'next';
|
type: 'previous' | 'next';
|
||||||
}) => (
|
}) => (
|
||||||
<CustomTooltip title={title} disabled={disabled}>
|
<CustomTooltip title={title} disabled={disabled}>
|
||||||
<CustomButton
|
<CustomButtonIcon sx={{ flexBasis: '15%' }} variant="contained" disabled={disabled} {...customIconButtonProps}>
|
||||||
sx={{ minWidth: 0, px: 1, flexBasis: '15%' }}
|
|
||||||
variant="contained"
|
|
||||||
disabled={disabled}
|
|
||||||
{...customIconButtonProps}
|
|
||||||
>
|
|
||||||
{type === 'previous' ? <KeyboardArrowLeftIcon /> : <KeyboardArrowRightIcon />}
|
{type === 'previous' ? <KeyboardArrowLeftIcon /> : <KeyboardArrowRightIcon />}
|
||||||
</CustomButton>
|
</CustomButtonIcon>
|
||||||
</CustomTooltip>
|
</CustomTooltip>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import Stack from '@mui/material/Stack';
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import FitScreenIcon from '@mui/icons-material/FitScreen';
|
import FitScreenIcon from '@mui/icons-material/FitScreen';
|
||||||
import { CustomTooltip } from '@/modules/core/components/CustomTooltip.tsx';
|
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 { ValueRotationButton } from '@/modules/core/components/buttons/ValueRotationButton.tsx';
|
||||||
import {
|
import {
|
||||||
IReaderSettings,
|
IReaderSettings,
|
||||||
@@ -23,6 +22,7 @@ import {
|
|||||||
READER_PAGE_SCALE_MODE_VALUES,
|
READER_PAGE_SCALE_MODE_VALUES,
|
||||||
} from '@/modules/reader/constants/ReaderSettings.constants.tsx';
|
} from '@/modules/reader/constants/ReaderSettings.constants.tsx';
|
||||||
import { MultiValueButtonDefaultableProps } from '@/modules/core/Core.types.ts';
|
import { MultiValueButtonDefaultableProps } from '@/modules/core/Core.types.ts';
|
||||||
|
import { CustomButtonIcon } from '@/modules/core/components/buttons/CustomButtonIcon.tsx';
|
||||||
|
|
||||||
export const ReaderNavBarDesktopPageScale = ({
|
export const ReaderNavBarDesktopPageScale = ({
|
||||||
pageScaleMode,
|
pageScaleMode,
|
||||||
@@ -52,14 +52,14 @@ export const ReaderNavBarDesktopPageScale = ({
|
|||||||
/>
|
/>
|
||||||
{READER_PAGE_SCALE_MODE_TO_SCALING_ALLOWED[pageScaleMode.value] && (
|
{READER_PAGE_SCALE_MODE_TO_SCALING_ALLOWED[pageScaleMode.value] && (
|
||||||
<CustomTooltip title={t('reader.settings.page_scale.stretch')}>
|
<CustomTooltip title={t('reader.settings.page_scale.stretch')}>
|
||||||
<CustomButton
|
<CustomButtonIcon
|
||||||
onClick={() => updateSetting('shouldStretchPage', !shouldStretchPage.value)}
|
onClick={() => updateSetting('shouldStretchPage', !shouldStretchPage.value)}
|
||||||
sx={{ minWidth: 0 }}
|
sx={{ px: undefined }}
|
||||||
variant="contained"
|
variant="contained"
|
||||||
color={shouldStretchPage.value ? 'secondary' : 'primary'}
|
color={shouldStretchPage.value ? 'secondary' : 'primary'}
|
||||||
>
|
>
|
||||||
<FitScreenIcon />
|
<FitScreenIcon />
|
||||||
</CustomButton>
|
</CustomButtonIcon>
|
||||||
</CustomTooltip>
|
</CustomTooltip>
|
||||||
)}
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|||||||
Reference in New Issue
Block a user