Compare commits

...

4 Commits

Author SHA1 Message Date
andrzej b32aabcd08 remove unused import 2024-06-24 11:56:06 +02:00
andrzej f245b8d72d merge navlinks styling 2024-06-24 11:55:31 +02:00
andrzej 04688feb28 add mode toggle 2024-06-24 11:55:19 +02:00
andrzej febaec3220 make badge more legible 2024-06-24 11:53:48 +02:00
5 changed files with 54 additions and 12 deletions

View File

@ -9,7 +9,7 @@ const badgeVariants = cva(
variants: { variants: {
variant: { variant: {
default: default:
"border-transparent bg-primary text-primary-foreground", "border-transparent bg-accent text-accent-foreground",
secondary: secondary:
"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80", "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
destructive: destructive:

View File

@ -8,6 +8,7 @@ import Link from "next/link";
import { ComponentProps } from "react"; import { ComponentProps } from "react";
import { Send } from "lucide-react"; import { Send } from "lucide-react";
import Navlinks from "./ui/navLinks"; import Navlinks from "./ui/navLinks";
import { ModeToggle } from "./ui/modeToggle";
const inter = Inter({ subsets: ["latin"] }); const inter = Inter({ subsets: ["latin"] });
@ -32,14 +33,14 @@ export default function RootLayout({
enableSystem enableSystem
disableTransitionOnChange disableTransitionOnChange
> >
<div id="layout-container" className="p-4 w-screen mt-6 flex justify-center"> <div id="layout-container" className="p-4 w-screen h-screen mt-6 flex justify-center">
<div className="grid grid-cols-12 w-5/6"> <div className="grid grid-cols-12 w-5/6">
<div id="sidebar" className="col-start-1 col-end-3"> <div id="sidebar" className="col-start-1 col-end-3 h-5/6 flex flex-col"> <header className="">
<header className=""> <h1 className="font-black text-4xl text-primary-foreground bg-primary antialiased w-full p-2">SubMan</h1>
<h1 className="font-black text-4xl text-primary-foreground bg-primary antialiased w-full p-2">SubMan</h1> <p className="mt-2 mx-1 text-sm antialiased">The self-hosted literary submission tracker.</p>
<p className="mt-2 mx-1 text-sm antialiased">The self-hosted literary submission tracker.</p> </header>
</header>
<Navlinks className="mt-6" /> <Navlinks className="mt-6" />
<footer className="mt-auto"><ModeToggle /></footer>
</div> </div>
<div className="col-start-3 col-span-full"> <div className="col-start-3 col-span-full">
{children} {children}

View File

@ -22,7 +22,6 @@ import {
} from "@/components/ui/popover" } from "@/components/ui/popover"
import GenresTrigger from "./genresTrigger" import GenresTrigger from "./genresTrigger"
import GenreCheckbox from "./genreCheckbox" import GenreCheckbox from "./genreCheckbox"
import { Badge } from "@/components/ui/badge"
import { useRef, useImperativeHandle } from "react" import { useRef, useImperativeHandle } from "react"
const formSchema = z.object({ const formSchema = z.object({

41
src/app/ui/modeToggle.tsx Normal file
View File

@ -0,0 +1,41 @@
"use client"
import * as React from "react"
import { MoonIcon, SunIcon } from "@radix-ui/react-icons"
import { useTheme } from "next-themes"
import { Button } from "@/components/ui/button"
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"
export function ModeToggle() {
const { setTheme } = useTheme()
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="outline" size="icon">
<SunIcon className="h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" />
<MoonIcon className="absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" />
<span className="sr-only">Toggle theme</span>
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
<DropdownMenuItem onClick={() => setTheme("light")}>
Light
</DropdownMenuItem>
<DropdownMenuItem onClick={() => setTheme("dark")}>
Dark
</DropdownMenuItem>
<DropdownMenuItem onClick={() => setTheme("system")}>
System
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
)
}

View File

@ -3,6 +3,7 @@ import Link from "next/link";
import { usePathname } from "next/navigation"; import { usePathname } from "next/navigation";
import { ComponentProps } from "react"; import { ComponentProps } from "react";
import clsx from "clsx"; import clsx from "clsx";
import { twMerge } from "tailwind-merge";
function NavLink(props: ComponentProps<"div"> & { href: string }) { function NavLink(props: ComponentProps<"div"> & { href: string }) {
@ -22,12 +23,12 @@ export default function Navlinks(props: ComponentProps<"div">) {
<div className="text-secondary-foreground" > <div className="text-secondary-foreground" >
{ {
links.map(e => (<NavLink key={e.link} href={e.link} links.map(e => (<NavLink key={e.link} href={e.link}
className={clsx("text-xl font-black my-2 w-full pl-2 antialiased", className={twMerge(clsx("text-xl drop-shadow font-black my-2 w-full pl-2 antialiased text-secondary-foreground bg-secondary",
{ {
"text-primary-foreground bg-primary": pathname === e.link "text-primary-foreground bg-primary": pathname.includes(e.link)
} }
)} ))}
>{e.label}</NavLink >)) ><p className="drop-shadow-sm">{e.label}</p></NavLink >))
} }
</ div> </ div>
</div> </div>