test refactor

This commit is contained in:
@kirill.komarov
2026-05-14 19:54:45 +05:00
parent 8165f75a78
commit ce9883f8c9
12 changed files with 175 additions and 175 deletions
@@ -0,0 +1,32 @@
import DarkModeOutlinedIcon from '@mui/icons-material/DarkModeOutlined'
import LightModeOutlinedIcon from '@mui/icons-material/LightModeOutlined'
import IconButton from '@mui/material/IconButton'
import Tooltip from '@mui/material/Tooltip'
import type { ThemeModePreference } from '@/shared/model/theme'
type Props = {
mode: ThemeModePreference
resolvedMode: 'light' | 'dark'
onCycleMode: () => void
}
function getModeLabel(mode: ThemeModePreference, resolvedMode: 'light' | 'dark'): string {
switch (mode) {
case 'system':
return `Авто (${resolvedMode === 'dark' ? 'тёмная' : 'светлая'})`
case 'light':
return 'Светлая'
case 'dark':
return 'Тёмная'
}
}
export function ModeSwitcher({ mode, resolvedMode, onCycleMode }: Props) {
return (
<Tooltip title={`Тема: ${getModeLabel(mode, resolvedMode)}`}>
<IconButton color="inherit" onClick={onCycleMode} aria-label="Переключить тему">
{resolvedMode === 'dark' ? <LightModeOutlinedIcon /> : <DarkModeOutlinedIcon />}
</IconButton>
</Tooltip>
)
}
@@ -0,0 +1 @@
export { ModeSwitcher } from './ModeSwitcher'