mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-11-24 09:45:35 +08:00
feat(config): update page layout
This commit is contained in:
parent
d059ea85b3
commit
2be357e73c
@ -36,7 +36,7 @@ import {
|
|||||||
setFavDayTheme,
|
setFavDayTheme,
|
||||||
setFavNightTheme,
|
setFavNightTheme,
|
||||||
setSelectedEndpoint,
|
setSelectedEndpoint,
|
||||||
setTwemoji,
|
setUseTwemoji,
|
||||||
useRequest,
|
useRequest,
|
||||||
useTwemoji,
|
useTwemoji,
|
||||||
} from '~/signals'
|
} from '~/signals'
|
||||||
@ -250,13 +250,27 @@ const ConfigForm = () => {
|
|||||||
const ConfigForXd = () => {
|
const ConfigForXd = () => {
|
||||||
const [t, { locale }] = useI18n()
|
const [t, { locale }] = useI18n()
|
||||||
|
|
||||||
const autoSwitchThemeSubChild = () => (
|
return (
|
||||||
|
<div class="grid grid-cols-2 gap-4">
|
||||||
|
<div class="flex flex-col gap-4">
|
||||||
|
<div>
|
||||||
|
<ConfigTitle>{t('autoSwitchTheme')}</ConfigTitle>
|
||||||
|
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
class="toggle"
|
||||||
|
checked={autoSwitchTheme()}
|
||||||
|
onChange={(e) => setAutoSwitchTheme(e.target.checked)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<Show when={autoSwitchTheme()}>
|
<Show when={autoSwitchTheme()}>
|
||||||
|
<div class="flex flex-col gap-4">
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
<ConfigTitle>{t('favDayTheme')}</ConfigTitle>
|
<ConfigTitle>{t('favDayTheme')}</ConfigTitle>
|
||||||
|
|
||||||
<select
|
<select
|
||||||
class="select select-bordered w-full max-w-xs"
|
class="select select-bordered"
|
||||||
onChange={(e) => setFavDayTheme(e.target.value)}
|
onChange={(e) => setFavDayTheme(e.target.value)}
|
||||||
>
|
>
|
||||||
<For each={themes}>
|
<For each={themes}>
|
||||||
@ -268,11 +282,12 @@ const ConfigForXd = () => {
|
|||||||
</For>
|
</For>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
<ConfigTitle>{t('favNightTheme')}</ConfigTitle>
|
<ConfigTitle>{t('favNightTheme')}</ConfigTitle>
|
||||||
|
|
||||||
<select
|
<select
|
||||||
class="select select-bordered w-full max-w-xs"
|
class="select select-bordered"
|
||||||
onChange={(e) => setFavNightTheme(e.target.value)}
|
onChange={(e) => setFavNightTheme(e.target.value)}
|
||||||
>
|
>
|
||||||
<For each={themes}>
|
<For each={themes}>
|
||||||
@ -284,44 +299,20 @@ const ConfigForXd = () => {
|
|||||||
</For>
|
</For>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</Show>
|
</Show>
|
||||||
)
|
</div>
|
||||||
|
|
||||||
const checkboxList = [
|
<div>
|
||||||
{
|
<ConfigTitle>{t('useTwemoji')}</ConfigTitle>
|
||||||
label: t('autoSwitchTheme'),
|
|
||||||
value: autoSwitchTheme,
|
|
||||||
onChange: (value: boolean) => setAutoSwitchTheme(value),
|
|
||||||
subChild: autoSwitchThemeSubChild,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: t('useTwemoji'),
|
|
||||||
value: useTwemoji,
|
|
||||||
onChange: setTwemoji,
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div class="grid gap-4">
|
|
||||||
<For each={checkboxList}>
|
|
||||||
{(checkbox) => (
|
|
||||||
<>
|
|
||||||
<div class="flex flex-col">
|
|
||||||
<ConfigTitle>{checkbox.label}</ConfigTitle>
|
|
||||||
|
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
class="toggle"
|
class="toggle"
|
||||||
checked={checkbox.value()}
|
checked={useTwemoji()}
|
||||||
onChange={(e) => {
|
onChange={(e) => setUseTwemoji(e.target.checked)}
|
||||||
checkbox.onChange(e.target.checked)
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{checkbox.subChild?.()}
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</For>
|
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<Button
|
<Button
|
||||||
@ -357,7 +348,7 @@ const Versions = () => {
|
|||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
return (
|
return (
|
||||||
<div class="mx-auto flex w-full max-w-screen-md flex-col gap-4">
|
<div class="mx-auto flex max-w-screen-md flex-col gap-4">
|
||||||
<DNSQueryForm />
|
<DNSQueryForm />
|
||||||
<ConfigForm />
|
<ConfigForm />
|
||||||
<ConfigForXd />
|
<ConfigForXd />
|
||||||
|
@ -40,7 +40,7 @@ export const [autoCloseConns, setAutoCloseConns] = makePersisted(
|
|||||||
createSignal(false),
|
createSignal(false),
|
||||||
{ name: 'autoCloseConns', storage: localStorage },
|
{ name: 'autoCloseConns', storage: localStorage },
|
||||||
)
|
)
|
||||||
export const [useTwemoji, setTwemoji] = makePersisted(createSignal(true), {
|
export const [useTwemoji, setUseTwemoji] = makePersisted(createSignal(true), {
|
||||||
name: 'useTwemoji',
|
name: 'useTwemoji',
|
||||||
storage: localStorage,
|
storage: localStorage,
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user