mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-06-08 09:26:59 +00:00
47 lines
1.1 KiB
TypeScript
47 lines
1.1 KiB
TypeScript
import { useThemeContext } from './ThemeContext';
|
|
import { IconButton, Tooltip } from '@mui/material';
|
|
import LightModeIcon from '@mui/icons-material/LightMode';
|
|
import DarkModeIcon from '@mui/icons-material/DarkMode';
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
const ThemeSelector = () => {
|
|
const { t } = useTranslation([
|
|
'auth',
|
|
'core',
|
|
'group',
|
|
'question',
|
|
'tutorial',
|
|
]);
|
|
const { themeMode, toggleTheme } = useThemeContext();
|
|
|
|
return (
|
|
<div
|
|
style={{
|
|
bottom: '1%',
|
|
display: 'flex',
|
|
gap: '12px',
|
|
left: '1.2vh',
|
|
position: 'absolute',
|
|
}}
|
|
>
|
|
<Tooltip
|
|
title={
|
|
themeMode === 'dark'
|
|
? t('core:theme.light_mode', {
|
|
postProcess: 'capitalizeFirstChar',
|
|
})
|
|
: t('core:theme.dark_mode', {
|
|
postProcess: 'capitalizeFirstChar',
|
|
})
|
|
}
|
|
>
|
|
<IconButton onClick={toggleTheme}>
|
|
{themeMode === 'dark' ? <LightModeIcon /> : <DarkModeIcon />}
|
|
</IconButton>
|
|
</Tooltip>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default ThemeSelector;
|