refactor: simplify some markups and styles

This commit is contained in:
rusconn
2023-10-14 23:36:37 +09:00
parent e1e512b594
commit 612613859c
4 changed files with 21 additions and 22 deletions

View File

@@ -51,14 +51,10 @@ export default function RootLayout({ children }: RootLayoutProps) {
> >
<ThemeProvider attribute="class" defaultTheme="system" disableTransitionOnChange> <ThemeProvider attribute="class" defaultTheme="system" disableTransitionOnChange>
<SearchTextProvider> <SearchTextProvider>
<div className="relative flex h-full flex-col"> <div className="grid h-full grid-cols-[18rem_1fr] grid-rows-[3.5rem_1fr]">
<SiteHeader /> <SiteHeader className="col-span-full" />
<div className="flex flex-1 overflow-y-hidden"> <Sidebar />
<Sidebar /> <main className="overflow-y-auto rounded-tl-md border bg-page p-12">{children}</main>
<main className="h-full flex-1 overflow-y-auto rounded-tl-md border bg-page p-12">
{children}
</main>
</div>
</div> </div>
<TailwindIndicator /> <TailwindIndicator />
</SearchTextProvider> </SearchTextProvider>

View File

@@ -7,12 +7,12 @@ import { ToolGroups } from "./sidebar/tool-groups";
export function Sidebar() { export function Sidebar() {
return ( return (
<nav className="flex w-72 flex-col"> <nav className="flex flex-col overflow-y-auto">
<div className="mt-px px-4"> <div className="mt-px px-4">
<SearchBar /> <SearchBar />
</div> </div>
<div className="flex-1 overflow-y-auto"> <div className="flex-1 overflow-y-auto">
<div className="mb-2 mt-4 px-2"> <div className="mt-2 p-2">
<AllTools /> <AllTools />
</div> </div>
<Separator /> <Separator />
@@ -21,7 +21,7 @@ export function Sidebar() {
</div> </div>
</div> </div>
<Separator /> <Separator />
<div className="justify-end p-2"> <div className="p-2">
<Settings /> <Settings />
</div> </div>
</nav> </nav>

View File

@@ -26,9 +26,9 @@ function RawToolLink({ Icon, shortTitle: title, href, onClick, className, highli
<span className={cn("invisible flex items-center", highlight !== "none" && "visible")}> <span className={cn("invisible flex items-center", highlight !== "none" && "visible")}>
<Indicator /> <Indicator />
</span> </span>
<span className="flex select-none items-center"> <span className="flex select-none items-center gap-4">
<Icon size={16} /> <Icon size={16} />
<span className="ml-4">{title}</span> <span>{title}</span>
</span> </span>
</Link> </Link>
); );

View File

@@ -1,13 +1,18 @@
import Link from "next/link"; import Link from "next/link";
import { siteConfig } from "@/config/site"; import { siteConfig } from "@/config/site";
import { cn } from "@/lib/style";
import { icons } from "@/components/icons"; import { icons } from "@/components/icons";
import { ThemeToggle } from "@/components/theme-toggle"; import { ThemeToggle } from "@/components/theme-toggle";
export function SiteHeader() { type Props = {
className?: string;
};
export function SiteHeader({ className }: Props) {
return ( return (
<header className="flex h-14 items-center justify-between px-4"> <header className={cn("flex items-center justify-between px-4", className)}>
<div className="flex items-baseline space-x-2.5"> <div className="flex items-baseline gap-x-2.5">
<Link className="text-lg" href="/"> <Link className="text-lg" href="/">
{siteConfig.name} {siteConfig.name}
</Link> </Link>
@@ -23,17 +28,15 @@ export function SiteHeader() {
</a> </a>
</small> </small>
</div> </div>
<div className="flex items-center space-x-1"> <div className="flex gap-x-1">
<a <a
className="group rounded-md p-2" className="group h-10 w-10 rounded-md p-2"
href={siteConfig.links.github} href={siteConfig.links.github}
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
> >
<div> <icons.GitHub className="group-hover:opacity-70" />
<icons.GitHub className="h-6 w-6 group-hover:opacity-70" /> <span className="sr-only">GitHub</span>
<span className="sr-only">GitHub</span>
</div>
</a> </a>
<ThemeToggle /> <ThemeToggle />
</div> </div>