Skip to content

Commit

Permalink
feat(www): refactor examples page (#5818)
Browse files Browse the repository at this point in the history
  • Loading branch information
shadcn authored Nov 13, 2024
1 parent 600a593 commit 805ed41
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 30 deletions.
18 changes: 11 additions & 7 deletions apps/www/app/(app)/examples/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Metadata } from "next"
import Link from "next/link"

import { siteConfig } from "@/config/site"
import { Announcement } from "@/components/announcement"
import { ExamplesNav } from "@/components/examples-nav"
import {
Expand All @@ -25,20 +26,23 @@ export default function ExamplesLayout({ children }: ExamplesLayoutProps) {
<div className="relative">
<PageHeader>
<Announcement />
<PageHeaderHeading className="hidden md:block">
Check out some examples
</PageHeaderHeading>
<PageHeaderHeading className="md:hidden">Examples</PageHeaderHeading>
<PageHeaderHeading>Build your component library</PageHeaderHeading>
<PageHeaderDescription>
Dashboard, cards, authentication. Some examples built using the
components. Use this as a guide to build your own.
Beautifully designed components that you can copy and paste into your
apps. Made with Tailwind CSS. Open source.
</PageHeaderDescription>
<PageActions>
<Button asChild size="sm">
<Link href="/docs">Get Started</Link>
</Button>
<Button asChild size="sm" variant="ghost">
<Link href="/components">Components</Link>
<Link
target="_blank"
rel="noreferrer"
href={siteConfig.links.github}
>
GitHub
</Link>
</Button>
</PageActions>
</PageHeader>
Expand Down
2 changes: 1 addition & 1 deletion apps/www/components/examples-nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export function ExamplesNav({ className, ...props }: ExamplesNavProps) {
<div className="relative">
<ScrollArea className="max-w-[600px] lg:max-w-none">
<div className={cn("mb-4 flex items-center", className)} {...props}>
{examples.map((example, index) => (
{examples.map((example) => (
<Link
href={example.href}
key={example.href}
Expand Down
25 changes: 7 additions & 18 deletions apps/www/components/main-nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function MainNav() {

return (
<div className="mr-4 hidden md:flex">
<Link href="/" className="mr-4 flex items-center space-x-2 lg:mr-6">
<Link href="/" className="mr-4 flex items-center gap-2 lg:mr-6">
<Icons.logo className="h-6 w-6" />
<span className="hidden font-bold lg:inline-block">
{siteConfig.name}
Expand All @@ -23,7 +23,7 @@ export function MainNav() {
href="/docs"
className={cn(
"transition-colors hover:text-foreground/80",
pathname === "/docs" ? "text-foreground" : "text-foreground/60"
pathname === "/docs" ? "text-foreground" : "text-foreground/80"
)}
>
Docs
Expand All @@ -35,7 +35,7 @@ export function MainNav() {
pathname?.startsWith("/docs/components") &&
!pathname?.startsWith("/docs/component/chart")
? "text-foreground"
: "text-foreground/60"
: "text-foreground/80"
)}
>
Components
Expand All @@ -46,7 +46,7 @@ export function MainNav() {
"transition-colors hover:text-foreground/80",
pathname?.startsWith("/blocks")
? "text-foreground"
: "text-foreground/60"
: "text-foreground/80"
)}
>
Blocks
Expand All @@ -58,7 +58,7 @@ export function MainNav() {
pathname?.startsWith("/docs/component/chart") ||
pathname?.startsWith("/charts")
? "text-foreground"
: "text-foreground/60"
: "text-foreground/80"
)}
>
Charts
Expand All @@ -69,29 +69,18 @@ export function MainNav() {
"transition-colors hover:text-foreground/80",
pathname?.startsWith("/themes")
? "text-foreground"
: "text-foreground/60"
: "text-foreground/80"
)}
>
Themes
</Link>
<Link
href="/examples"
className={cn(
"hidden transition-colors hover:text-foreground/80 lg:inline-block",
pathname?.startsWith("/examples")
? "text-foreground"
: "text-foreground/60"
)}
>
Examples
</Link>
<Link
href="/colors"
className={cn(
"transition-colors hover:text-foreground/80",
pathname?.startsWith("/colors")
? "text-foreground"
: "text-foreground/60"
: "text-foreground/80"
)}
>
Colors
Expand Down
4 changes: 0 additions & 4 deletions apps/www/config/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ export const docsConfig: DocsConfig = {
title: "Themes",
href: "/themes",
},
{
title: "Examples",
href: "/examples",
},
{
title: "Colors",
href: "/colors",
Expand Down

0 comments on commit 805ed41

Please sign in to comment.