Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 8x 8x 8x 8x 8x 8x 8x 8x 8x 1x 1x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x 8x | /**
* @file AppearanceMenuSection.tsx
* @module app/HamburgerMenu/AppearanceMenuSection
*
* @summary
* Appearance menu section coordinator that composes theme and density settings.
* Acts as a thin container orchestrating sub-components from AppearanceSettings subdirectory.
*
* @enterprise
* - Delegates individual settings to focused sub-components
* - Integrates with useSettings hook for persistence
* - Maintains clean separation of concerns
*/
import { Box, Typography, Stack } from '@mui/material';
import { useTranslation } from 'react-i18next';
import { useSettings } from '../../hooks/useSettings';
import { ThemeToggle, TableDensitySetting } from './AppearanceSettings';
interface AppearanceMenuSectionProps {
/** Current theme mode (light or dark) */
themeMode: 'light' | 'dark';
/** Callback when theme mode changes */
onThemeModeChange: (mode: 'light' | 'dark') => void;
}
/**
* Appearance menu section component.
*
* Coordinates two distinct appearance setting controls:
* 1. Theme toggle (light/dark mode with icons)
* 2. Table density radio group (comfortable vs compact)
*
* @param props - Component props
* @returns JSX element rendering the appearance settings section
*/
export default function AppearanceMenuSection({
themeMode,
onThemeModeChange,
}: AppearanceMenuSectionProps) {
const { t } = useTranslation(['common']);
const { userPreferences, setUserPreferences } = useSettings();
// Handler for density changes - persists to user preferences
const handleDensityChange = (newDensity: 'compact' | 'comfortable') => {
setUserPreferences({ tableDensity: newDensity });
};
return (
<Box sx={{ px: 2, py: 1.5 }}>
<Typography variant="subtitle2" sx={{ fontWeight: 600, mb: 1.5 }}>
{t('appearance.title', 'Erscheinungsbild / Appearance')}
</Typography>
<Stack spacing={1.5}>
{/* Theme Toggle Component */}
<ThemeToggle themeMode={themeMode} onThemeModeChange={onThemeModeChange} />
{/* Table Density Setting Component */}
<TableDensitySetting
tableDensity={userPreferences.tableDensity}
onChange={handleDensityChange}
/>
</Stack>
</Box>
);
}
|