mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-11-10 05:15:35 +08:00
feat(config): move switch language button into header
This commit is contained in:
parent
dd0452dcd3
commit
9cc99ebb8e
@ -28,7 +28,7 @@ export const Collapse: ParentComponent<Props> = (props) => {
|
||||
<div
|
||||
class={twMerge(
|
||||
getCollapseClassName(),
|
||||
'collapse collapse-arrow select-none overflow-visible border-secondary bg-base-200',
|
||||
'collapse collapse-arrow select-none overflow-visible border-secondary bg-base-200 drop-shadow-md',
|
||||
)}
|
||||
>
|
||||
<div
|
||||
|
@ -4,6 +4,7 @@ import {
|
||||
IconFileStack,
|
||||
IconGlobe,
|
||||
IconHome,
|
||||
IconLanguage,
|
||||
IconMenu,
|
||||
IconNetwork,
|
||||
IconPalette,
|
||||
@ -11,8 +12,8 @@ import {
|
||||
IconSettings,
|
||||
} from '@tabler/icons-solidjs'
|
||||
import { For, ParentComponent, Show, createSignal } from 'solid-js'
|
||||
import { LogoText } from '~/components'
|
||||
import { ROUTES, themes } from '~/constants'
|
||||
import { Button, LogoText } from '~/components'
|
||||
import { LANG, ROUTES, themes } from '~/constants'
|
||||
import { setCurTheme } from '~/signals'
|
||||
|
||||
const Nav: ParentComponent<{ href: string; tooltip: string }> = ({
|
||||
@ -61,7 +62,7 @@ const ThemeSwitcher = () => (
|
||||
)
|
||||
|
||||
export const Header = () => {
|
||||
const [t] = useI18n()
|
||||
const [t, { locale }] = useI18n()
|
||||
const navs = () => [
|
||||
{
|
||||
href: ROUTES.Overview,
|
||||
@ -151,6 +152,17 @@ export const Header = () => {
|
||||
|
||||
<div class="navbar-end">
|
||||
<div class="flex items-center gap-2">
|
||||
<Button
|
||||
class="btn-circle btn-secondary btn-sm"
|
||||
onClick={() => {
|
||||
const curLocale = locale()
|
||||
|
||||
locale(curLocale === LANG.EN ? LANG.ZH : LANG.EN)
|
||||
}}
|
||||
>
|
||||
<IconLanguage />
|
||||
</Button>
|
||||
|
||||
<ThemeSwitcher />
|
||||
</div>
|
||||
</div>
|
||||
|
@ -27,7 +27,7 @@ import {
|
||||
upgradingBackend,
|
||||
} from '~/apis'
|
||||
import { Button, ConfigTitle } from '~/components'
|
||||
import { LANG, MODE_OPTIONS, ROUTES, themes } from '~/constants'
|
||||
import { MODE_OPTIONS, ROUTES, themes } from '~/constants'
|
||||
import {
|
||||
autoSwitchTheme,
|
||||
favDayTheme,
|
||||
@ -269,22 +269,10 @@ const ConfigForm = () => {
|
||||
}
|
||||
|
||||
const ConfigForXd = () => {
|
||||
const [t, { locale }] = useI18n()
|
||||
const [t] = useI18n()
|
||||
|
||||
return (
|
||||
<div class="grid grid-cols-2 place-items-center gap-4">
|
||||
<div class="col-span-2">
|
||||
<Button
|
||||
onClick={() => {
|
||||
const curLocale = locale()
|
||||
|
||||
locale(curLocale === LANG.EN ? LANG.ZH : LANG.EN)
|
||||
}}
|
||||
>
|
||||
{t('switchLanguage')}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-4">
|
||||
<div>
|
||||
<ConfigTitle>{t('autoSwitchTheme')}</ConfigTitle>
|
||||
|
Loading…
Reference in New Issue
Block a user