collapse some settings

This commit is contained in:
布丁狗~ 2024-09-07 10:16:59 +08:00 committed by pompurin404
parent 7908afd83b
commit 42d09a0dd0
No known key found for this signature in database
4 changed files with 12 additions and 5 deletions

View File

@ -1,15 +1,22 @@
import React from 'react' import React from 'react'
import { Card, CardBody } from '@nextui-org/react' import { Accordion, AccordionItem, Card, CardBody } from '@nextui-org/react'
interface Props { interface Props {
title?: string
children?: React.ReactNode children?: React.ReactNode
} }
const SettingCard: React.FC<Props> = (props) => { const SettingCard: React.FC<Props> = (props) => {
return ( return !props.title ? (
<Card className="m-2"> <Card className="m-2">
<CardBody>{props.children}</CardBody> <CardBody>{props.children}</CardBody>
</Card> </Card>
) : (
<Accordion isCompact className="my-2" variant="splitted">
<AccordionItem hideIndicator keepContentMounted title={props.title}>
{props.children}
</AccordionItem>
</Accordion>
) )
} }

View File

@ -52,7 +52,7 @@ const ShortcutConfig: React.FC = () => {
} = appConfig || {} } = appConfig || {}
return ( return (
<SettingCard> <SettingCard title="快捷键设置">
<SettingItem title="打开/关闭窗口" divider> <SettingItem title="打开/关闭窗口" divider>
<div className="flex justify-end w-[60%]"> <div className="flex justify-end w-[60%]">
<ShortcutInput <ShortcutInput

View File

@ -53,7 +53,7 @@ const SiderConfig: React.FC = () => {
} }
return ( return (
<SettingCard> <SettingCard title="侧边栏设置">
{Object.keys(cardStatus).map((key, index, array) => { {Object.keys(cardStatus).map((key, index, array) => {
return ( return (
<SettingItem title={titleMap[key]} key={key} divider={index !== array.length - 1}> <SettingItem title={titleMap[key]} key={key} divider={index !== array.length - 1}>

View File

@ -48,7 +48,7 @@ const WebdavConfig: React.FC = () => {
{restoreOpen && ( {restoreOpen && (
<WebdavRestoreModal filenames={filenames} onClose={() => setRestoreOpen(false)} /> <WebdavRestoreModal filenames={filenames} onClose={() => setRestoreOpen(false)} />
)} )}
<SettingCard> <SettingCard title="WebDav 备份">
<SettingItem title="WebDav 地址" divider> <SettingItem title="WebDav 地址" divider>
<Input <Input
size="sm" size="sm"