style navlinks

This commit is contained in:
andrzej 2024-06-20 20:02:25 +02:00
parent 1950e31cfe
commit 054ba0b224
9 changed files with 154 additions and 143 deletions

View File

@ -1,76 +1,77 @@
@tailwind base; @tailwind base;
@tailwind components; @tailwind components;
@tailwind utilities; @tailwind utilities;
@layer base { @layer base {
:root { :root {
--background: 0 0% 100%; --background: 0 0% 100%;
--foreground: 222.2 84% 4.9%; --foreground: 222.2 84% 4.9%;
--card: 0 0% 100%; --card: 0 0% 100%;
--card-foreground: 222.2 84% 4.9%; --card-foreground: 222.2 84% 4.9%;
--popover: 0 0% 100%; --popover: 0 0% 100%;
--popover-foreground: 222.2 84% 4.9%; --popover-foreground: 222.2 84% 4.9%;
--primary: 222.2 47.4% 11.2%; --primary: 222.2 47.4% 11.2%;
--primary-foreground: 210 40% 98%; --primary-foreground: 210 40% 98%;
--secondary: 210 40% 96.1%; --secondary: 210 40% 96.1%;
--secondary-foreground: 222.2 47.4% 11.2%; --secondary-foreground: 222.2 47.4% 11.2%;
--muted: 210 40% 96.1%; --muted: 210 40% 96.1%;
--muted-foreground: 215.4 16.3% 46.9%; --muted-foreground: 215.4 16.3% 46.9%;
--accent: 210 40% 96.1%; --accent: 210 40% 96.1%;
--accent-foreground: 222.2 47.4% 11.2%; --accent-foreground: 222.2 47.4% 11.2%;
--destructive: 0 84.2% 60.2%; --destructive: 0 84.2% 60.2%;
--destructive-foreground: 210 40% 98%; --destructive-foreground: 210 40% 98%;
--border: 214.3 31.8% 91.4%; --border: 214.3 31.8% 91.4%;
--input: 214.3 31.8% 91.4%; --input: 214.3 31.8% 91.4%;
--ring: 222.2 84% 4.9%; --ring: 222.2 84% 4.9%;
--radius: 0.5rem; --radius: 0.5rem;
}
.dark {
--background: 222.2 84% 4.9%;
--foreground: 210 40% 98%;
--card: 222.2 84% 4.9%;
--card-foreground: 210 40% 98%;
--popover: 222.2 84% 4.9%;
--popover-foreground: 210 40% 98%;
--primary: 210 40% 98%;
--primary-foreground: 222.2 47.4% 11.2%;
--secondary: 217.2 32.6% 17.5%;
--secondary-foreground: 210 40% 98%;
--muted: 217.2 32.6% 17.5%;
--muted-foreground: 215 20.2% 65.1%;
--accent: 217.2 32.6% 17.5%;
--accent-foreground: 210 40% 98%;
--destructive: 0 62.8% 30.6%;
--destructive-foreground: 210 40% 98%;
--border: 217.2 32.6% 17.5%;
--input: 217.2 32.6% 17.5%;
--ring: 212.7 26.8% 83.9%;
}
} }
@layer base { .dark {
* { --background: 222.2 84% 4.9%;
@apply border-border; --foreground: 210 40% 98%;
}
body { --card: 222.2 84% 4.9%;
@apply bg-background text-foreground; --card-foreground: 210 40% 98%;
}
--popover: 222.2 84% 4.9%;
--popover-foreground: 210 40% 98%;
--primary: 210 40% 98%;
--primary-foreground: 222.2 47.4% 11.2%;
--secondary: 217.2 32.6% 17.5%;
--secondary-foreground: 210 40% 98%;
--muted: 217.2 32.6% 17.5%;
--muted-foreground: 215 20.2% 65.1%;
--accent: 217.2 32.6% 17.5%;
--accent-foreground: 210 40% 98%;
--destructive: 0 62.8% 30.6%;
--destructive-foreground: 210 40% 98%;
--border: 217.2 32.6% 17.5%;
--input: 217.2 32.6% 17.5%;
--ring: 212.7 26.8% 83.9%;
} }
}
@layer base {
* {
@apply border-border;
}
body {
@apply bg-background text-foreground;
}
}

View File

@ -1,10 +1,12 @@
import type { Metadata } from "next"; import type { Metadata } from "next";
import { Inter } from "next/font/google"; import { Inter } from "next/font/google";
import { Toaster } from "@/components/ui/toaster"; import { Toaster } from "@/components/ui/toaster";
import "./tailwind.css"; import "./tailwind.css";
import Link from "next/link"; 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";
const inter = Inter({ subsets: ["latin"] }); const inter = Inter({ subsets: ["latin"] });
@ -31,12 +33,10 @@ export default function RootLayout({
<div id="layout-container" className="flex p-4"> <div id="layout-container" className="flex p-4">
<div id="sidebar" > <div id="sidebar" >
<header className="mb-6"> <header className="mb-6">
<h1 className="font-black text-6xl antialiased inline">SubMan</h1> <Send className="inline" size={"3rem"} /> <h1 className="font-black text-6xl antialiased inline">SubMan</h1> <Send className="inline mb-6" size={"3rem"} />
<p className="font-bold text-xl antialiased">The self-hosted literary<br /> submission tracker.</p> <p className="font-bold text-xl antialiased">The self-hosted literary<br /> submission tracker.</p>
</header> </header>
<NavLink href="/story">STORIES</NavLink> <Navlinks />
<NavLink href="/publication">PUBLICATIONS</NavLink>
<NavLink href="/submission">SUBMISSIONS</NavLink>
</div> </div>
{children} {children}
</div> </div>

View File

@ -4,6 +4,7 @@ import { columns } from "app/submission/columns"
import { PageHeader, PageSubHeader } from "app/ui/pageHeader" import { PageHeader, PageSubHeader } from "app/ui/pageHeader"
import { DataTable } from "app/ui/tables/data-table" import { DataTable } from "app/ui/tables/data-table"
import { Badge } from "@/components/ui/badge" import { Badge } from "@/components/ui/badge"
import GenreBadges from "app/ui/genreBadges"
//ids are string here because they're coming from url params //ids are string here because they're coming from url params
async function getStoryWithGenres(id: string) { async function getStoryWithGenres(id: string) {
@ -30,7 +31,7 @@ export default async function Page({ params }: { params: { id: string } }) {
return <> return <>
<div className="container"> <div className="container">
<PageHeader>{data?.title ?? ""}</PageHeader> <PageHeader>{data?.title ?? ""}</PageHeader>
{data.genres.map(e => (<Badge>{e.name}</Badge>))} <GenreBadges genres={data.genres} className="my-6" />
<PageSubHeader>Submissions:</PageSubHeader> <PageSubHeader>Submissions:</PageSubHeader>
<DataTable columns={columns} data={storySubs} /> <DataTable columns={columns} data={storySubs} />

View File

@ -17,6 +17,7 @@ import {
import { deleteStory } from "app/lib/del" import { deleteStory } from "app/lib/del"
import Link from "next/link" import Link from "next/link"
import { DialogClose } from "@radix-ui/react-dialog" import { DialogClose } from "@radix-ui/react-dialog"
import GenreBadges from "app/ui/genreBadges"
const columnHelper = createColumnHelper<StoryWithGenres>() const columnHelper = createColumnHelper<StoryWithGenres>()
@ -55,8 +56,7 @@ export const columns: ColumnDef<StoryWithGenres>[] = [
columnHelper.accessor("genres", { columnHelper.accessor("genres", {
cell: props => { cell: props => {
const genres = props.getValue() const genres = props.getValue()
.map(e => <Badge>{e.name}</Badge>) return <GenreBadges genres={genres} />
return genres
}, },
filterFn: "arrIncludes" filterFn: "arrIncludes"
//TODO - write custom filter function, to account for an array of objects //TODO - write custom filter function, to account for an array of objects

View File

@ -684,14 +684,6 @@ body {
z-index: 100; z-index: 100;
} }
.m-4 {
margin: 1rem;
}
.m-2 {
margin: 0.5rem;
}
.-mx-1 { .-mx-1 {
margin-left: -0.25rem; margin-left: -0.25rem;
margin-right: -0.25rem; margin-right: -0.25rem;
@ -712,10 +704,19 @@ body {
margin-bottom: 0.5rem; margin-bottom: 0.5rem;
} }
.my-6 {
margin-top: 1.5rem;
margin-bottom: 1.5rem;
}
.mb-4 { .mb-4 {
margin-bottom: 1rem; margin-bottom: 1rem;
} }
.mb-6 {
margin-bottom: 1.5rem;
}
.ml-2 { .ml-2 {
margin-left: 0.5rem; margin-left: 0.5rem;
} }
@ -728,12 +729,12 @@ body {
margin-top: 0.5rem; margin-top: 0.5rem;
} }
.mt-4 { .mt-3 {
margin-top: 1rem; margin-top: 0.75rem;
} }
.mb-6 { .mt-4 {
margin-bottom: 1.5rem; margin-top: 1rem;
} }
.inline { .inline {
@ -877,38 +878,6 @@ body {
width: 100%; width: 100%;
} }
.w-3\/4 {
width: 75%;
}
.w-1\/5 {
width: 20%;
}
.w-11 {
width: 2.75rem;
}
.w-5 {
width: 1.25rem;
}
.w-8 {
width: 2rem;
}
.w-6 {
width: 1.5rem;
}
.w-16 {
width: 4rem;
}
.w-20 {
width: 5rem;
}
.min-w-\[8rem\] { .min-w-\[8rem\] {
min-width: 8rem; min-width: 8rem;
} }
@ -1297,23 +1266,25 @@ body {
text-align: center; text-align: center;
} }
.text-right {
text-align: right;
}
.align-middle { .align-middle {
vertical-align: middle; vertical-align: middle;
} }
.font-display {
font-family: Playfair;
}
.text-3xl { .text-3xl {
font-size: 1.875rem; font-size: 1.875rem;
line-height: 2.25rem; line-height: 2.25rem;
} }
.text-4xl {
font-size: 2.25rem;
line-height: 2.5rem;
}
.text-6xl {
font-size: 3.75rem;
line-height: 1;
}
.text-\[0\.8rem\] { .text-\[0\.8rem\] {
font-size: 0.8rem; font-size: 0.8rem;
} }
@ -1333,30 +1304,24 @@ body {
line-height: 1.25rem; line-height: 1.25rem;
} }
.text-xs {
font-size: 0.75rem;
line-height: 1rem;
}
.text-xl { .text-xl {
font-size: 1.25rem; font-size: 1.25rem;
line-height: 1.75rem; line-height: 1.75rem;
} }
.text-4xl { .text-xs {
font-size: 2.25rem; font-size: 0.75rem;
line-height: 2.5rem; line-height: 1rem;
}
.text-6xl {
font-size: 3.75rem;
line-height: 1;
} }
.font-black { .font-black {
font-weight: 900; font-weight: 900;
} }
.font-bold {
font-weight: 700;
}
.font-medium { .font-medium {
font-weight: 500; font-weight: 500;
} }
@ -1369,10 +1334,6 @@ body {
font-weight: 600; font-weight: 600;
} }
.font-bold {
font-weight: 700;
}
.capitalize { .capitalize {
text-transform: capitalize; text-transform: capitalize;
} }
@ -1433,6 +1394,11 @@ body {
color: hsl(var(--secondary-foreground)); color: hsl(var(--secondary-foreground));
} }
.text-slate-50 {
--tw-text-opacity: 1;
color: rgb(248 250 252 / var(--tw-text-opacity));
}
.text-white { .text-white {
--tw-text-opacity: 1; --tw-text-opacity: 1;
color: rgb(255 255 255 / var(--tw-text-opacity)); color: rgb(255 255 255 / var(--tw-text-opacity));

View File

@ -0,0 +1,11 @@
import { Genre } from "@prisma/client";
import { ComponentProps } from "react";
import { Badge } from "@/components/ui/badge";
export default function GenreBadges(props: ComponentProps<"div"> & { genres: Array<Genre> }) {
return (
<div className={props.className}>
{props.genres.map((e: Genre) => (<Badge key={e.name}>{e.name}</Badge>))}
</div>
)
}

33
src/app/ui/navLinks.tsx Normal file
View File

@ -0,0 +1,33 @@
"use client"
import Link from "next/link";
import { usePathname } from "next/navigation";
import { ComponentProps } from "react";
import clsx from "clsx";
function NavLink(props: ComponentProps<"div"> & { href: string }) {
return (
<Link href={props.href}><h1 className={props.className}>{props.children}</h1></Link>
)
}
export default function Navlinks(props: ComponentProps<"div">) {
const pathname = usePathname()
const links = [
{ link: "/story", label: "STORIES" },
{ link: "/publication", label: "PUBLICATIONS" },
{ link: "/submission", label: "SUBMISSIONS" },
]
return (
<>
{links.map(e => (<NavLink key={e.link} href={e.link}
className={clsx("text-4xl font-black my-2",
{
"text-destructive": pathname === e.link
}
)}
>{e.label}</NavLink >))
}
{pathname}
</>
)
}

View File

@ -1,9 +1,9 @@
import { ComponentProps } from "react" import { ComponentProps } from "react"
export function PageHeader(props: ComponentProps<"h1">) { export function PageHeader(props: ComponentProps<"h1">) {
return <h1 className="text-3xl font-display font-bold">{props.children}</h1> return <h1 className="text-3xl font-bold mt-3">{props.children}</h1>
} }
export function PageSubHeader(props: ComponentProps<"h2">) { export function PageSubHeader(props: ComponentProps<"h2">) {
return <h2 className="text-xl font-display font-bold">{props.children}</h2> return <h2 className="text-xl font-bold">{props.children}</h2>
} }

View File

@ -82,4 +82,3 @@ module.exports = {
}, },
plugins: [require("tailwindcss-animate")], plugins: [require("tailwindcss-animate")],
}; };