import React from 'react'; import { useTranslation } from 'react-i18next'; import { Grid, Paper, Switch, useTheme, FormControlLabel, List, ListItem, ListItemIcon, Slider, Typography, ToggleButtonGroup, ToggleButton, } from '@mui/material'; import { Settings } from '../../models'; import SelectLanguage from './SelectLanguage'; import { Translate, Palette, LightMode, DarkMode, SettingsOverscan, Link, } from '@mui/icons-material'; interface SettingsFormProps { dense?: boolean; settings: Settings; setSettings: (state: Settings) => void; network?: boolean; } const SettingsForm = ({ dense = false, settings, setSettings, network = false, }: SettingsFormProps): JSX.Element => { const theme = useTheme(); const { t } = useTranslation(); const fontSizes = [ { label: 'XS', value: { basic: 12, pro: 10 } }, { label: 'S', value: { basic: 13, pro: 11 } }, { label: 'M', value: { basic: 14, pro: 12 } }, { label: 'L', value: { basic: 15, pro: 13 } }, { label: 'XL', value: { basic: 16, pro: 14 } }, ]; return ( setSettings({ ...settings, language })} /> } icon={ } onChange={(e) => setSettings({ ...settings, mode: e.target.checked ? 'dark' : 'light' }) } /> } /> setSettings({ ...settings, fontSize: e.target.value })} valueLabelDisplay='off' marks={fontSizes.map(({ label, value }) => ({ label: {t(label)}, value: settings.frontend === 'basic' ? value.basic : value.pro, }))} track={false} /> {network ? ( setSettings({ ...settings, network: value })} > {t('Mainnet')} {t('Testnet')} ) : ( <> )} ); }; export default SettingsForm;