mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-06-16 04:51:20 +00:00
Use Box instead of div
This commit is contained in:
parent
72b0b913bb
commit
e68317da3a
@ -2,6 +2,8 @@ import { useRef, useState } from 'react';
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { supportedLanguages } from '../../i18n/i18n';
|
import { supportedLanguages } from '../../i18n/i18n';
|
||||||
import {
|
import {
|
||||||
|
Box,
|
||||||
|
Button,
|
||||||
FormControl,
|
FormControl,
|
||||||
MenuItem,
|
MenuItem,
|
||||||
Select,
|
Select,
|
||||||
@ -26,16 +28,7 @@ const LanguageSelector = () => {
|
|||||||
supportedLanguages[currentLang] || supportedLanguages['en'];
|
supportedLanguages[currentLang] || supportedLanguages['en'];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<Box ref={selectorRef}>
|
||||||
ref={selectorRef}
|
|
||||||
style={{
|
|
||||||
bottom: '5%',
|
|
||||||
display: 'flex',
|
|
||||||
gap: '12px',
|
|
||||||
left: '1.5vh',
|
|
||||||
position: 'absolute',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{!showSelect && (
|
{!showSelect && (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
key={currentLang}
|
key={currentLang}
|
||||||
@ -43,13 +36,10 @@ const LanguageSelector = () => {
|
|||||||
postProcess: 'capitalizeFirstChar',
|
postProcess: 'capitalizeFirstChar',
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<button
|
<Button
|
||||||
onClick={() => setShowSelect(true)}
|
onClick={() => setShowSelect(true)}
|
||||||
style={{
|
style={{
|
||||||
fontSize: '1.5rem',
|
fontSize: '1.3rem',
|
||||||
border: 'none',
|
|
||||||
background: 'none',
|
|
||||||
cursor: 'pointer',
|
|
||||||
}}
|
}}
|
||||||
aria-label={t('core:current_language', {
|
aria-label={t('core:current_language', {
|
||||||
language: name,
|
language: name,
|
||||||
@ -57,7 +47,7 @@ const LanguageSelector = () => {
|
|||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
{flag}
|
{flag}
|
||||||
</button>
|
</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@ -70,13 +60,13 @@ const LanguageSelector = () => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Select
|
<Select
|
||||||
open
|
|
||||||
labelId="language-select-label"
|
|
||||||
id="language-select"
|
|
||||||
value={currentLang}
|
|
||||||
onChange={handleChange}
|
|
||||||
autoFocus
|
autoFocus
|
||||||
|
id="language-select"
|
||||||
|
labelId="language-select-label"
|
||||||
|
onChange={handleChange}
|
||||||
onClose={() => setShowSelect(false)}
|
onClose={() => setShowSelect(false)}
|
||||||
|
open
|
||||||
|
value={currentLang}
|
||||||
>
|
>
|
||||||
{Object.entries(supportedLanguages).map(([code, { name }]) => (
|
{Object.entries(supportedLanguages).map(([code, { name }]) => (
|
||||||
<MenuItem key={code} value={code}>
|
<MenuItem key={code} value={code}>
|
||||||
@ -86,7 +76,7 @@ const LanguageSelector = () => {
|
|||||||
</Select>
|
</Select>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
)}
|
)}
|
||||||
</div>
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import { useThemeContext } from './ThemeContext';
|
import { useThemeContext } from './ThemeContext';
|
||||||
import { IconButton, Tooltip } from '@mui/material';
|
import { Box, IconButton, Tooltip } from '@mui/material';
|
||||||
import LightModeIcon from '@mui/icons-material/LightMode';
|
import LightModeIcon from '@mui/icons-material/LightMode';
|
||||||
import DarkModeIcon from '@mui/icons-material/DarkMode';
|
import DarkModeIcon from '@mui/icons-material/DarkMode';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { useRef } from 'react';
|
||||||
|
|
||||||
const ThemeSelector = () => {
|
const ThemeSelector = () => {
|
||||||
const { t } = useTranslation([
|
const { t } = useTranslation([
|
||||||
@ -13,17 +14,10 @@ const ThemeSelector = () => {
|
|||||||
'tutorial',
|
'tutorial',
|
||||||
]);
|
]);
|
||||||
const { themeMode, toggleTheme } = useThemeContext();
|
const { themeMode, toggleTheme } = useThemeContext();
|
||||||
|
const selectorRef = useRef(null);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<Box ref={selectorRef}>
|
||||||
style={{
|
|
||||||
bottom: '1%',
|
|
||||||
display: 'flex',
|
|
||||||
gap: '12px',
|
|
||||||
left: '1.2vh',
|
|
||||||
position: 'absolute',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Tooltip
|
<Tooltip
|
||||||
title={
|
title={
|
||||||
themeMode === 'dark'
|
themeMode === 'dark'
|
||||||
@ -39,7 +33,7 @@ const ThemeSelector = () => {
|
|||||||
{themeMode === 'dark' ? <LightModeIcon /> : <DarkModeIcon />}
|
{themeMode === 'dark' ? <LightModeIcon /> : <DarkModeIcon />}
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user