The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
improved blog layout
Steven Teydf09150f7c4d
diff --git a/app/dub.co/blog/category/[slug]/page.tsx b/app/dub.co/blog/(index)/category/[slug]/page.tsxsimilarity index 100%rename from app/dub.co/blog/category/[slug]/page.tsxrename to app/dub.co/blog/(index)/category/[slug]/page.tsxdiff --git a/app/dub.co/blog/layout.tsx b/app/dub.co/blog/(index)/layout.tsxsimilarity index 100%rename from app/dub.co/blog/layout.tsxrename to app/dub.co/blog/(index)/layout.tsxdiff --git a/app/dub.co/blog/page.tsx b/app/dub.co/blog/(index)/page.tsxsimilarity index 100%rename from app/dub.co/blog/page.tsxrename to app/dub.co/blog/(index)/page.tsxdiff --git a/app/dub.co/(blog-post)/blog/[slug]/page.tsx b/app/dub.co/blog/(post)/[slug]/page.tsxsimilarity index 100%rename from app/dub.co/(blog-post)/blog/[slug]/page.tsxrename to app/dub.co/blog/(post)/[slug]/page.tsxdiff --git a/app/ui/content/blog-layout-hero.tsx b/app/ui/content/blog-layout-hero.tsxindex bfa43a918c..5e8fb49cf5 100644--- a/app/ui/content/blog-layout-hero.tsx+++ b/app/ui/content/blog-layout-hero.tsx@@ -1,10 +1,11 @@"use client";import { BLOG_CATEGORIES } from "#/lib/constants/content";-import { cn } from "#/lib/utils";import MaxWidthWrapper from "@/components/shared/max-width-wrapper";import Link from "next/link";import { useParams } from "next/navigation";+import { motion } from "framer-motion";+import { cn } from "#/lib/utils";export default function BlogLayoutHero() {const { slug } = useParams() as { slug?: string };@@ -20,8 +21,8 @@ export default function BlogLayoutHero() {<p className="mt-4 text-xl text-gray-500">{data?.description || "Latest news and updates from Dub."}</p>- <div className="mt-6 flex items-center space-x-4">- <CategoryLink title="All" href="/blog" active={!slug} />+ <nav className="mt-6 flex w-fit items-center space-x-2 rounded-full border border-gray-200 bg-white p-2">+ <CategoryLink title="Overview" href="/blog" active={!slug} />{BLOG_CATEGORIES.map((category) => (<CategoryLinkkey={category.slug}@@ -30,13 +31,9 @@ export default function BlogLayoutHero() {active={category.slug === slug}/>))}- <CategoryLink- title="Customer Stories"- href="/customers"- active={false}- />- <CategoryLink title="Changelog" href="/changelog" active={false} />- </div>+ <CategoryLink title="Customer Stories" href="/customers" />+ <CategoryLink title="Changelog" href="/changelog" />+ </nav></div></MaxWidthWrapper>);@@ -49,18 +46,25 @@ const CategoryLink = ({}: {title: string;href: string;- active: boolean;+ active?: boolean;}) => {return (- <Link- href={href}- className={cn("border-b-2 border-transparent py-1", {- "border-black text-black": active,- })}- >- <div className="rounded-md px-3 py-2 text-sm text-gray-600 transition-all hover:bg-gray-100 active:bg-gray-200">+ <Link href={href} className="relative z-10">+ <div+ className={cn(+ "rounded-full px-4 py-2 text-sm text-gray-600 transition-all",+ active ? "text-white" : "hover:bg-gray-100 active:bg-gray-200",+ )}+ >{title}</div>+ {active && (+ <motion.div+ layoutId="indicator"+ className="absolute left-0 top-0 h-full w-full rounded-full bg-gradient-to-tr from-gray-800 via-gray-700 to-gray-800"+ style={{ zIndex: -1 }}+ />+ )}</Link>);};