Set appbar color on light theme

This commit is contained in:
schroda
2024-09-06 16:59:27 +02:00
parent 0a4124062b
commit 1423ca23be
16 changed files with 80 additions and 26 deletions

View File

@@ -7,19 +7,26 @@
*/ */
import TextField, { TextFieldProps } from '@mui/material/TextField'; import TextField, { TextFieldProps } from '@mui/material/TextField';
import IconButton from '@mui/material/IconButton'; import IconButton, { IconButtonProps } from '@mui/material/IconButton';
import InputAdornment from '@mui/material/InputAdornment'; import InputAdornment from '@mui/material/InputAdornment';
import CancelIcon from '@mui/icons-material/Cancel'; import CancelIcon from '@mui/icons-material/Cancel';
export const SearchTextField = ({ onCancel, ...textFieldProps }: TextFieldProps & { onCancel: () => void }) => ( export const SearchTextField = ({
onCancel,
cancelButtonProps,
...textFieldProps
}: TextFieldProps & { onCancel: () => void; cancelButtonProps?: IconButtonProps }) => (
<TextField <TextField
{...textFieldProps} {...textFieldProps}
slotProps={{ slotProps={{
input: { input: {
...textFieldProps.InputProps, ...textFieldProps.InputProps,
sx: {
color: 'inherit',
},
endAdornment: textFieldProps.InputProps?.endAdornment ?? ( endAdornment: textFieldProps.InputProps?.endAdornment ?? (
<InputAdornment position="end"> <InputAdornment position="end">
<IconButton onClick={() => onCancel()}> <IconButton {...cancelButtonProps} onClick={() => onCancel()}>
<CancelIcon /> <CancelIcon />
</IconButton> </IconButton>
</InputAdornment> </InputAdornment>

View File

@@ -24,7 +24,13 @@ export const SelectableCollectionSelectAll = ({
return ( return (
<Tooltip title={t(!areAllItemsSelected ? 'global.button.select_all' : 'global.button.clear')}> <Tooltip title={t(!areAllItemsSelected ? 'global.button.select_all' : 'global.button.clear')}>
<Checkbox <Checkbox
sx={{ padding: '8px' }} sx={{
padding: '8px',
color: 'inherit',
'&.Mui-checked': {
color: 'inherit',
},
}}
checked={areAllItemsSelected} checked={areAllItemsSelected}
indeterminate={!areNoItemsSelected && !areAllItemsSelected} indeterminate={!areNoItemsSelected && !areAllItemsSelected}
onChange={(_, checked) => onChange(checked)} onChange={(_, checked) => onChange(checked)}

View File

@@ -39,7 +39,13 @@ export const SelectableCollectionSelectMode = ({
<Tooltip title={t(!isActive ? 'global.button.select_all' : 'global.button.cancel')}> <Tooltip title={t(!isActive ? 'global.button.select_all' : 'global.button.cancel')}>
<Checkbox <Checkbox
checkedIcon={<ClearIcon />} checkedIcon={<ClearIcon />}
sx={{ padding: '8px' }} sx={{
padding: '8px',
color: 'inherit',
'&.Mui-checked': {
color: 'inherit',
},
}}
checked={isActive} checked={isActive}
onChange={(_, checked) => onModeChange(checked)} onChange={(_, checked) => onModeChange(checked)}
/> />

View File

@@ -27,7 +27,7 @@ export const LibraryToolbarMenu: React.FC = () => {
return ( return (
<> <>
<Tooltip title={t('settings.title')}> <Tooltip title={t('settings.title')}>
<IconButton onClick={() => setOpen(!open)} color={active ? 'warning' : 'default'}> <IconButton onClick={() => setOpen(!open)} color={active ? 'warning' : 'inherit'}>
<FilterList /> <FilterList />
</IconButton> </IconButton>
</Tooltip> </Tooltip>

View File

@@ -132,6 +132,7 @@ export function UpdateChecker({
: { onClick: () => onClick() })} : { onClick: () => onClick() })}
onMouseEnter={() => setIsHovered(true)} onMouseEnter={() => setIsHovered(true)}
onMouseLeave={() => setIsHovered(false)} onMouseLeave={() => setIsHovered(false)}
color="inherit"
> >
{!isRunning ? ( {!isRunning ? (
<RefreshIcon /> <RefreshIcon />
@@ -139,7 +140,11 @@ export function UpdateChecker({
<> <>
<ClearIcon sx={{ opacity: Number(isTouchDevice || isHovered) }} /> <ClearIcon sx={{ opacity: Number(isTouchDevice || isHovered) }} />
<Stack sx={{ position: 'absolute' }}> <Stack sx={{ position: 'absolute' }}>
<Progress progress={progress} showText={!isTouchDevice && !isHovered} /> <Progress
progress={progress}
showText={!isTouchDevice && !isHovered}
progressProps={{ color: 'inherit' }}
/>
</Stack> </Stack>
</> </>
)} )}

View File

@@ -56,6 +56,7 @@ export const MangaToolbarMenu = ({ manga, onRefresh, refreshing }: IProps) => {
onRefresh(); onRefresh();
}} }}
disabled={refreshing} disabled={refreshing}
color="inherit"
> >
<Refresh /> <Refresh />
</IconButton> </IconButton>
@@ -68,7 +69,7 @@ export const MangaToolbarMenu = ({ manga, onRefresh, refreshing }: IProps) => {
state={{ mangaTitle: manga.title }} state={{ mangaTitle: manga.title }}
style={{ textDecoration: 'none', color: 'inherit' }} style={{ textDecoration: 'none', color: 'inherit' }}
> >
<IconButton> <IconButton color="inherit">
<SyncAltIcon /> <SyncAltIcon />
</IconButton> </IconButton>
</Link> </Link>
@@ -78,6 +79,7 @@ export const MangaToolbarMenu = ({ manga, onRefresh, refreshing }: IProps) => {
onClick={() => { onClick={() => {
openCategorySelect(true); openCategorySelect(true);
}} }}
color="inherit"
> >
<Label /> <Label />
</IconButton> </IconButton>
@@ -94,6 +96,7 @@ export const MangaToolbarMenu = ({ manga, onRefresh, refreshing }: IProps) => {
aria-haspopup="true" aria-haspopup="true"
aria-expanded={open ? 'true' : undefined} aria-expanded={open ? 'true' : undefined}
onClick={(e) => setAnchorEl(e.currentTarget)} onClick={(e) => setAnchorEl(e.currentTarget)}
color="inherit"
> >
<MoreHoriz /> <MoreHoriz />
</IconButton> </IconButton>

View File

@@ -25,6 +25,7 @@ import { useLocation } from 'react-router-dom';
import ArrowForwardIcon from '@mui/icons-material/ArrowForward'; import ArrowForwardIcon from '@mui/icons-material/ArrowForward';
import MenuIcon from '@mui/icons-material/Menu'; import MenuIcon from '@mui/icons-material/Menu';
import Stack from '@mui/material/Stack'; import Stack from '@mui/material/Stack';
import { useTheme } from '@mui/material/styles';
import { NavbarItem } from '@/typings'; import { NavbarItem } from '@/typings';
import { NavBarContext } from '@/components/context/NavbarContext'; import { NavBarContext } from '@/components/context/NavbarContext';
import { useBackButton } from '@/util/useBackButton.ts'; import { useBackButton } from '@/util/useBackButton.ts';
@@ -76,6 +77,7 @@ export function DefaultNavBar() {
const { title, action, override, isCollapsed, setIsCollapsed, setAppBarHeight, navBarWidth, setNavBarWidth } = const { title, action, override, isCollapsed, setIsCollapsed, setAppBarHeight, navBarWidth, setNavBarWidth } =
useContext(NavBarContext); useContext(NavBarContext);
const theme = useTheme();
const { pathname } = useLocation(); const { pathname } = useLocation();
const handleBack = useBackButton(); const handleBack = useBackButton();
@@ -123,9 +125,8 @@ export function DefaultNavBar() {
position: 'fixed', position: 'fixed',
marginLeft: actualNavBarWidth, marginLeft: actualNavBarWidth,
width: `calc(100% - ${actualNavBarWidth}px)`, width: `calc(100% - ${actualNavBarWidth}px)`,
zIndex: (theme) => theme.zIndex.drawer + 1, zIndex: theme.zIndex.drawer + 1,
}} }}
color="default"
> >
<Toolbar sx={{ position: 'relative' }}> <Toolbar sx={{ position: 'relative' }}>
{!isMobileWidth && ( {!isMobileWidth && (
@@ -138,7 +139,7 @@ export function DefaultNavBar() {
alignItems: 'center', alignItems: 'center',
}} }}
> >
<IconButton aria-label="open drawer" onClick={() => setIsCollapsed(false)}> <IconButton aria-label="open drawer" onClick={() => setIsCollapsed(false)} color="inherit">
<MenuIcon /> <MenuIcon />
</IconButton> </IconButton>
</Stack> </Stack>
@@ -159,6 +160,7 @@ export function DefaultNavBar() {
size="large" size="large"
aria-label="menu" aria-label="menu"
onClick={handleBack} onClick={handleBack}
color="inherit"
> >
{getOptionForDirection(<ArrowBack />, <ArrowForwardIcon />)} {getOptionForDirection(<ArrowBack />, <ArrowForwardIcon />)}
</IconButton> </IconButton>

View File

@@ -50,6 +50,7 @@ export function GridLayouts({
aria-controls={open ? 'account-menu' : undefined} aria-controls={open ? 'account-menu' : undefined}
aria-haspopup="true" aria-haspopup="true"
aria-expanded={open ? 'true' : undefined} aria-expanded={open ? 'true' : undefined}
color="inherit"
> >
<ViewModuleIcon /> <ViewModuleIcon />
</IconButton> </IconButton>

View File

@@ -119,7 +119,7 @@ export const TrackerSearch = ({
<PopupState variant="popover" popupId="tracker-search-info"> <PopupState variant="popover" popupId="tracker-search-info">
{(popupState) => ( {(popupState) => (
<> <>
<IconButton {...bindTrigger(popupState)}> <IconButton {...bindTrigger(popupState)} color="inherit">
<InfoIcon /> <InfoIcon />
</IconButton> </IconButton>
<Popover <Popover

View File

@@ -13,6 +13,7 @@ import Tooltip from '@mui/material/Tooltip';
import { useQueryParam, StringParam } from 'use-query-params'; import { useQueryParam, StringParam } from 'use-query-params';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useLocation } from 'react-router-dom'; import { useLocation } from 'react-router-dom';
import { useTheme } from '@mui/material/styles';
import { SearchTextField } from '@/components/atoms/SearchTextField.tsx'; import { SearchTextField } from '@/components/atoms/SearchTextField.tsx';
interface IProps { interface IProps {
@@ -22,6 +23,7 @@ interface IProps {
export const AppbarSearch: React.FunctionComponent<IProps> = (props) => { export const AppbarSearch: React.FunctionComponent<IProps> = (props) => {
const { isClosable = true } = props; const { isClosable = true } = props;
const theme = useTheme();
const { t } = useTranslation(); const { t } = useTranslation();
const [prevLocationKey, setPrevLocationKey] = useState<string>(); const [prevLocationKey, setPrevLocationKey] = useState<string>();
@@ -103,13 +105,27 @@ export const AppbarSearch: React.FunctionComponent<IProps> = (props) => {
}} }}
onBlur={handleBlur} onBlur={handleBlur}
inputRef={inputRef} inputRef={inputRef}
sx={{
...theme.applyStyles('light', {
'& .MuiInput-underline:before': {
borderBottomColor: 'primary.contrastText', // Default color
},
'& .MuiInput-underline:hover:before': {
borderBottomColor: 'primary.contrastText', // Hover color
},
'& .MuiInput-underline:after': {
borderBottomColor: 'primary.dark', // Focused color
},
}),
}}
cancelButtonProps={{ sx: { ...theme.applyStyles('light', { color: 'primary.contrastText' }) } }}
/> />
); );
} }
return ( return (
<Tooltip title={t('search.title.search')}> <Tooltip title={t('search.title.search')}>
<IconButton onClick={() => updateSearchOpenState(true)}> <IconButton onClick={() => updateSearchOpenState(true)} color="inherit">
<SearchIcon /> <SearchIcon />
</IconButton> </IconButton>
</Tooltip> </Tooltip>

View File

@@ -7,12 +7,20 @@
*/ */
import Box from '@mui/material/Box'; import Box from '@mui/material/Box';
import CircularProgress from '@mui/material/CircularProgress'; import CircularProgress, { CircularProgressProps } from '@mui/material/CircularProgress';
import Typography from '@mui/material/Typography'; import Typography from '@mui/material/Typography';
export const Progress = ({ progress, showText = true }: { progress: number; showText?: boolean }) => ( export const Progress = ({
progress,
showText = true,
progressProps = {},
}: {
progress: number;
showText?: boolean;
progressProps?: CircularProgressProps;
}) => (
<Box sx={{ display: 'grid', placeItems: 'center', position: 'relative' }}> <Box sx={{ display: 'grid', placeItems: 'center', position: 'relative' }}>
<CircularProgress variant="determinate" value={progress} /> <CircularProgress {...progressProps} variant="determinate" value={progress} />
{showText && ( {showText && (
<Box sx={{ position: 'absolute' }}> <Box sx={{ position: 'absolute' }}>
<Typography <Typography

View File

@@ -139,13 +139,13 @@ export const DownloadQueue: React.FC = () => {
setAction( setAction(
<> <>
<Tooltip title={t('download.queue.label.delete_all')}> <Tooltip title={t('download.queue.label.delete_all')}>
<IconButton onClick={clearQueue} size="large"> <IconButton onClick={clearQueue} size="large" color="inherit">
<DeleteSweepIcon /> <DeleteSweepIcon />
</IconButton> </IconButton>
</Tooltip> </Tooltip>
<Tooltip title={t(status === 'STOPPED' ? 'global.button.start' : 'global.button.stop')}> <Tooltip title={t(status === 'STOPPED' ? 'global.button.start' : 'global.button.stop')}>
<IconButton onClick={toggleQueueStatus} size="large" disabled={isQueueEmpty}> <IconButton onClick={toggleQueueStatus} size="large" disabled={isQueueEmpty} color="inherit">
{status === 'STOPPED' ? <PlayArrowIcon /> : <PauseIcon />} {status === 'STOPPED' ? <PlayArrowIcon /> : <PauseIcon />}
</IconButton> </IconButton>
</Tooltip> </Tooltip>

View File

@@ -179,7 +179,7 @@ export function Extensions({ tabsMenuHeight }: { tabsMenuHeight: number }) {
<> <>
<AppbarSearch /> <AppbarSearch />
<Tooltip title={t('extension.action.label.install_external')}> <Tooltip title={t('extension.action.label.install_external')}>
<IconButton onClick={() => inputRef.current?.click()} size="large"> <IconButton onClick={() => inputRef.current?.click()} size="large" color="inherit">
<AddIcon /> <AddIcon />
</IconButton> </IconButton>
</Tooltip> </Tooltip>

View File

@@ -6,10 +6,10 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. * file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/ */
import Chip from '@mui/material/Chip'; import Chip, { ChipProps } from '@mui/material/Chip';
import Tab from '@mui/material/Tab'; import Tab from '@mui/material/Tab';
import { styled } from '@mui/material/styles'; import { styled } from '@mui/material/styles';
import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react'; import { useCallback, useContext, useEffect, useMemo, useState } from 'react';
import { useQueryParam, NumberParam } from 'use-query-params'; import { useQueryParam, NumberParam } from 'use-query-params';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { requestManager } from '@/lib/requests/RequestManager.ts'; import { requestManager } from '@/lib/requests/RequestManager.ts';
@@ -45,8 +45,8 @@ const TitleWithSizeTag = styled('span')({
alignItems: 'center', alignItems: 'center',
}); });
const TitleSizeTag = (props: React.ComponentProps<typeof Chip>) => ( const TitleSizeTag = ({ sx, ...props }: ChipProps) => (
<Chip {...props} size="small" sx={{ marginLeft: '5px' }} /> <Chip {...props} size="small" sx={{ ...sx, marginLeft: '5px' }} />
); );
export function Library() { export function Library() {
@@ -152,7 +152,7 @@ export function Library() {
const navBarTitle = ( const navBarTitle = (
<TitleWithSizeTag> <TitleWithSizeTag>
{title} {title}
{options.showTabSize && <TitleSizeTag label={librarySize} />} {options.showTabSize && <TitleSizeTag sx={{ color: 'inherit' }} label={librarySize} />}
</TitleWithSizeTag> </TitleWithSizeTag>
); );
setTitle(navBarTitle, title); setTitle(navBarTitle, title);

View File

@@ -96,7 +96,7 @@ export function Sources() {
setAction( setAction(
<> <>
<Tooltip title={t('search.title.global_search')}> <Tooltip title={t('search.title.global_search')}>
<IconButton onClick={() => navigate('/sources/all/search/')} size="large"> <IconButton onClick={() => navigate('/sources/all/search/')} size="large" color="inherit">
<TravelExploreIcon /> <TravelExploreIcon />
</IconButton> </IconButton>
</Tooltip> </Tooltip>

View File

@@ -126,7 +126,7 @@ export const LibraryDuplicates = () => {
<PopupState variant="popover" popupId="library-dupliactes-settings"> <PopupState variant="popover" popupId="library-dupliactes-settings">
{(popupState) => ( {(popupState) => (
<> <>
<IconButton {...bindTrigger(popupState)}> <IconButton {...bindTrigger(popupState)} color="inherit">
<SettingsIcon /> <SettingsIcon />
</IconButton> </IconButton>
<Menu {...bindMenu(popupState)}> <Menu {...bindMenu(popupState)}>