From 5aaa45cade03cd63e60db994987157c924c225d8 Mon Sep 17 00:00:00 2001 From: andrzej Date: Thu, 20 Jun 2024 20:02:25 +0200 Subject: [PATCH] style navlinks --- src/app/globals.css | 127 ++++++++++++++++++------------------ src/app/layout.tsx | 8 +-- src/app/story/[id]/page.tsx | 3 +- src/app/story/columns.tsx | 4 +- src/app/tailwind.css | 106 ++++++++++-------------------- src/app/ui/genreBadges.tsx | 11 ++++ src/app/ui/navLinks.tsx | 33 ++++++++++ src/app/ui/pageHeader.tsx | 4 +- tailwind.config.js | 1 - 9 files changed, 154 insertions(+), 143 deletions(-) create mode 100644 src/app/ui/genreBadges.tsx create mode 100644 src/app/ui/navLinks.tsx diff --git a/src/app/globals.css b/src/app/globals.css index b0e6fff..bc724a1 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -1,76 +1,77 @@ @tailwind base; - @tailwind components; - @tailwind utilities; +@tailwind components; +@tailwind utilities; - @layer base { - :root { - --background: 0 0% 100%; - --foreground: 222.2 84% 4.9%; +@layer base { + :root { + --background: 0 0% 100%; + --foreground: 222.2 84% 4.9%; - --card: 0 0% 100%; - --card-foreground: 222.2 84% 4.9%; + --card: 0 0% 100%; + --card-foreground: 222.2 84% 4.9%; - --popover: 0 0% 100%; - --popover-foreground: 222.2 84% 4.9%; + --popover: 0 0% 100%; + --popover-foreground: 222.2 84% 4.9%; - --primary: 222.2 47.4% 11.2%; - --primary-foreground: 210 40% 98%; + --primary: 222.2 47.4% 11.2%; + --primary-foreground: 210 40% 98%; - --secondary: 210 40% 96.1%; - --secondary-foreground: 222.2 47.4% 11.2%; + --secondary: 210 40% 96.1%; + --secondary-foreground: 222.2 47.4% 11.2%; - --muted: 210 40% 96.1%; - --muted-foreground: 215.4 16.3% 46.9%; + --muted: 210 40% 96.1%; + --muted-foreground: 215.4 16.3% 46.9%; - --accent: 210 40% 96.1%; - --accent-foreground: 222.2 47.4% 11.2%; + --accent: 210 40% 96.1%; + --accent-foreground: 222.2 47.4% 11.2%; - --destructive: 0 84.2% 60.2%; - --destructive-foreground: 210 40% 98%; + --destructive: 0 84.2% 60.2%; + --destructive-foreground: 210 40% 98%; - --border: 214.3 31.8% 91.4%; - --input: 214.3 31.8% 91.4%; - --ring: 222.2 84% 4.9%; + --border: 214.3 31.8% 91.4%; + --input: 214.3 31.8% 91.4%; + --ring: 222.2 84% 4.9%; - --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%; - } + --radius: 0.5rem; } - @layer base { - * { - @apply border-border; - } - body { - @apply bg-background text-foreground; - } - } \ No newline at end of file + .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 { + * { + @apply border-border; + } + + body { + @apply bg-background text-foreground; + } +} diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 1220de6..5cdf07f 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,10 +1,12 @@ import type { Metadata } from "next"; import { Inter } from "next/font/google"; + import { Toaster } from "@/components/ui/toaster"; import "./tailwind.css"; import Link from "next/link"; import { ComponentProps } from "react"; import { Send } from "lucide-react"; +import Navlinks from "./ui/navLinks"; const inter = Inter({ subsets: ["latin"] }); @@ -31,12 +33,10 @@ export default function RootLayout({
{children}
diff --git a/src/app/story/[id]/page.tsx b/src/app/story/[id]/page.tsx index d8992e7..58c7e8b 100644 --- a/src/app/story/[id]/page.tsx +++ b/src/app/story/[id]/page.tsx @@ -4,6 +4,7 @@ import { columns } from "app/submission/columns" import { PageHeader, PageSubHeader } from "app/ui/pageHeader" import { DataTable } from "app/ui/tables/data-table" import { Badge } from "@/components/ui/badge" +import GenreBadges from "app/ui/genreBadges" //ids are string here because they're coming from url params async function getStoryWithGenres(id: string) { @@ -30,7 +31,7 @@ export default async function Page({ params }: { params: { id: string } }) { return <>
{data?.title ?? ""} - {data.genres.map(e => ({e.name}))} + Submissions: diff --git a/src/app/story/columns.tsx b/src/app/story/columns.tsx index b9449b4..67d7674 100644 --- a/src/app/story/columns.tsx +++ b/src/app/story/columns.tsx @@ -17,6 +17,7 @@ import { import { deleteStory } from "app/lib/del" import Link from "next/link" import { DialogClose } from "@radix-ui/react-dialog" +import GenreBadges from "app/ui/genreBadges" const columnHelper = createColumnHelper() @@ -55,8 +56,7 @@ export const columns: ColumnDef[] = [ columnHelper.accessor("genres", { cell: props => { const genres = props.getValue() - .map(e => {e.name}) - return genres + return }, filterFn: "arrIncludes" //TODO - write custom filter function, to account for an array of objects diff --git a/src/app/tailwind.css b/src/app/tailwind.css index 1fa66f4..5bd4fb7 100644 --- a/src/app/tailwind.css +++ b/src/app/tailwind.css @@ -684,14 +684,6 @@ body { z-index: 100; } -.m-4 { - margin: 1rem; -} - -.m-2 { - margin: 0.5rem; -} - .-mx-1 { margin-left: -0.25rem; margin-right: -0.25rem; @@ -712,10 +704,19 @@ body { margin-bottom: 0.5rem; } +.my-6 { + margin-top: 1.5rem; + margin-bottom: 1.5rem; +} + .mb-4 { margin-bottom: 1rem; } +.mb-6 { + margin-bottom: 1.5rem; +} + .ml-2 { margin-left: 0.5rem; } @@ -728,12 +729,12 @@ body { margin-top: 0.5rem; } -.mt-4 { - margin-top: 1rem; +.mt-3 { + margin-top: 0.75rem; } -.mb-6 { - margin-bottom: 1.5rem; +.mt-4 { + margin-top: 1rem; } .inline { @@ -877,38 +878,6 @@ body { 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-width: 8rem; } @@ -1297,23 +1266,25 @@ body { text-align: center; } -.text-right { - text-align: right; -} - .align-middle { vertical-align: middle; } -.font-display { - font-family: Playfair; -} - .text-3xl { font-size: 1.875rem; 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\] { font-size: 0.8rem; } @@ -1333,30 +1304,24 @@ body { line-height: 1.25rem; } -.text-xs { - font-size: 0.75rem; - line-height: 1rem; -} - .text-xl { font-size: 1.25rem; line-height: 1.75rem; } -.text-4xl { - font-size: 2.25rem; - line-height: 2.5rem; -} - -.text-6xl { - font-size: 3.75rem; - line-height: 1; +.text-xs { + font-size: 0.75rem; + line-height: 1rem; } .font-black { font-weight: 900; } +.font-bold { + font-weight: 700; +} + .font-medium { font-weight: 500; } @@ -1369,10 +1334,6 @@ body { font-weight: 600; } -.font-bold { - font-weight: 700; -} - .capitalize { text-transform: capitalize; } @@ -1433,6 +1394,11 @@ body { color: hsl(var(--secondary-foreground)); } +.text-slate-50 { + --tw-text-opacity: 1; + color: rgb(248 250 252 / var(--tw-text-opacity)); +} + .text-white { --tw-text-opacity: 1; color: rgb(255 255 255 / var(--tw-text-opacity)); @@ -2033,4 +1999,4 @@ body { .\[\&_tr\]\:border-b tr { border-bottom-width: 1px; -} \ No newline at end of file +} diff --git a/src/app/ui/genreBadges.tsx b/src/app/ui/genreBadges.tsx new file mode 100644 index 0000000..799f9b8 --- /dev/null +++ b/src/app/ui/genreBadges.tsx @@ -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 }) { + return ( +
+ {props.genres.map((e: Genre) => ({e.name}))} +
+ ) +} diff --git a/src/app/ui/navLinks.tsx b/src/app/ui/navLinks.tsx new file mode 100644 index 0000000..cc3bbb3 --- /dev/null +++ b/src/app/ui/navLinks.tsx @@ -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 ( +

{props.children}

+ ) +} +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 => ({e.label})) + } + {pathname} + + ) +} diff --git a/src/app/ui/pageHeader.tsx b/src/app/ui/pageHeader.tsx index 21c35ce..d0bb587 100644 --- a/src/app/ui/pageHeader.tsx +++ b/src/app/ui/pageHeader.tsx @@ -1,9 +1,9 @@ import { ComponentProps } from "react" export function PageHeader(props: ComponentProps<"h1">) { - return

{props.children}

+ return

{props.children}

} export function PageSubHeader(props: ComponentProps<"h2">) { - return

{props.children}

+ return

{props.children}

} diff --git a/tailwind.config.js b/tailwind.config.js index a310c9f..59ca8b6 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -82,4 +82,3 @@ module.exports = { }, plugins: [require("tailwindcss-animate")], }; -