update: preference page layout

This commit is contained in:
Purp1e
2024-09-27 15:28:32 +08:00
parent 125875c5e9
commit d62f4f9389
6 changed files with 80 additions and 23 deletions

View File

@@ -0,0 +1,12 @@
"use client"
import useAppStore from "@/store/app"
export default function Page () {
const { version } = useAppStore()
return (
<div className="flex flex-col items-start gap-3">
<button>{version}</button>
</div>
)
}

View File

@@ -0,0 +1,37 @@
"use client"
import { Card, CardHeader, CardIcon, CardTool, CardBody } from "@/components/window/Card"
import { ToolButton } from "@/components/window/ToolButton"
import { SettingConfig, UploadOne, HardDisk } from "@icon-park/react"
import { useRouter } from "next/navigation"
// import { platform } from "@tauri-apps/plugin-os"
export default function PreferenceLayout({ children }: { children: React.ReactNode }) {
const router = useRouter()
return (
<Card className="max-w-full overflow-y-scroll">
<CardHeader>
<CardIcon onClick={() => router.push("/preference/general")}>
<SettingConfig />
</CardIcon>
<CardIcon onClick={() => router.push("/preference/path")}>
<SettingConfig />
</CardIcon>
<CardIcon onClick={() => router.push("/preference/replay")}>
<SettingConfig />
</CardIcon>
<CardTool>
<ToolButton>
<UploadOne />
</ToolButton>
<ToolButton>
<HardDisk />
</ToolButton>
</CardTool>
</CardHeader>
<CardBody>{children}</CardBody>
</Card>
)
}

View File

@@ -1,3 +1,6 @@
"use client"
import { redirect } from "next/navigation"
export default function Page() {
return <div>Preference</div>;
redirect("/preference/general")
}

View File

@@ -0,0 +1,4 @@
"use client"
export default function Page() {
return <>Path</>
}

View File

@@ -0,0 +1,4 @@
"use client"
export default function Page() {
return <>Replay</>
}

View File

@@ -1,8 +1,9 @@
import { ReactNode } from "react";
import { ReactNode } from "react"
interface CardProps {
children?: ReactNode;
className?: string;
children?: ReactNode
className?: string
onClick?: () => void
}
const Card = ({ children }: CardProps) => {
@@ -13,31 +14,27 @@ const Card = ({ children }: CardProps) => {
>
{children}
</div>
);
};
)
}
const CardHeader = ({ children }: CardProps) => {
return (
<div className="flex items-center gap-2.5 tracking-wide">{children}</div>
);
};
return <div className="flex items-center gap-2.5 tracking-wide">{children}</div>
}
const CardIcon = ({ children }: CardProps) => {
const CardIcon = ({ children, ...rest }: CardProps) => {
return (
<div className="flex gap-1.5 items-center font-semibold">{children}</div>
);
};
const CardTool = ({ children }: CardProps) => {
return (
<div className="flex items-center justify-end flex-grow gap-2">
<div className="flex gap-1.5 items-center font-semibold" {...rest}>
{children}
</div>
);
};
)
}
const CardTool = ({ children }: CardProps) => {
return <div className="flex items-center justify-end flex-grow gap-2">{children}</div>
}
const CardBody = ({ children }: CardProps) => {
return <div className="w-full h-full text-sm tracking-wide text-zinc-800">{children}</div>;
};
return <div className="w-full h-full text-sm tracking-wide text-zinc-800">{children}</div>
}
export { Card, CardHeader, CardIcon, CardTool, CardBody };
export { Card, CardHeader, CardIcon, CardTool, CardBody }