add main nav on landing + clean up
This commit is contained in:
@@ -1,25 +0,0 @@
|
|||||||
import clsx from "clsx"
|
|
||||||
import { useScrolled } from "~/hooks/dom/use-scrolled"
|
|
||||||
|
|
||||||
export function HeaderLayout({
|
|
||||||
header,
|
|
||||||
body,
|
|
||||||
}: {
|
|
||||||
header: React.ReactNode
|
|
||||||
body: React.ReactNode
|
|
||||||
}) {
|
|
||||||
const isScrolled = useScrolled()
|
|
||||||
return (
|
|
||||||
<div className="isolate">
|
|
||||||
<header
|
|
||||||
className={clsx(
|
|
||||||
isScrolled ? "bg-slate-700/30" : "bg-slate-800",
|
|
||||||
"shadow-md sticky top-0 py-3 backdrop-blur-sm transition z-10 h-16 flex",
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
<div className="m-auto w-full max-w-screen-lg px-6">{header}</div>
|
|
||||||
</header>
|
|
||||||
<div className="m-auto max-w-screen-lg px-6 mt-8">{body}</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -4,9 +4,9 @@ import { Link } from "remix"
|
|||||||
import { ExternalLink } from "~/components/external-link"
|
import { ExternalLink } from "~/components/external-link"
|
||||||
import { linkClass } from "~/styles"
|
import { linkClass } from "~/styles"
|
||||||
|
|
||||||
export function HeaderNav() {
|
export function MainNavigation() {
|
||||||
return (
|
return (
|
||||||
<nav className="flex justify-between items-center">
|
<nav className="flex justify-between items-center h-16">
|
||||||
<Link to="/">
|
<Link to="/">
|
||||||
<h1 className="text-3xl font-light">reacord</h1>
|
<h1 className="text-3xl font-light">reacord</h1>
|
||||||
</Link>
|
</Link>
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
import type { ReactNode } from "react"
|
|
||||||
|
|
||||||
export function SideNav({
|
|
||||||
heading,
|
|
||||||
children,
|
|
||||||
}: {
|
|
||||||
heading: ReactNode
|
|
||||||
children: ReactNode
|
|
||||||
}) {
|
|
||||||
return (
|
|
||||||
<nav>
|
|
||||||
<h2 className="text-2xl">{heading}</h2>
|
|
||||||
<div className="mt-3 flex flex-col gap-2 items-start">{children}</div>
|
|
||||||
</nav>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
import type { ReactNode } from "react"
|
|
||||||
|
|
||||||
export function SidebarLayout({
|
|
||||||
sidebar,
|
|
||||||
body,
|
|
||||||
}: {
|
|
||||||
sidebar: ReactNode
|
|
||||||
body: ReactNode
|
|
||||||
}) {
|
|
||||||
return (
|
|
||||||
<div className="flex items-start gap-6">
|
|
||||||
<div className="w-64 sticky top-24">{sidebar}</div>
|
|
||||||
<div className="flex-1 min-w-0">{body}</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,13 +1,11 @@
|
|||||||
import clsx from "clsx"
|
import clsx from "clsx"
|
||||||
import type { LoaderFunction } from "remix"
|
import type { LoaderFunction } from "remix"
|
||||||
import { Link, Outlet, useLoaderData } from "remix"
|
import { Link, Outlet, useLoaderData } from "remix"
|
||||||
import { HeaderLayout } from "~/components/header-layout"
|
import { MainNavigation } from "~/components/main-navigation"
|
||||||
import { HeaderNav } from "~/components/header-nav"
|
|
||||||
import { SideNav } from "~/components/side-nav"
|
|
||||||
import { SidebarLayout } from "~/components/sidebar-layout"
|
|
||||||
import type { ContentIndexEntry } from "~/helpers/create-index.server"
|
import type { ContentIndexEntry } from "~/helpers/create-index.server"
|
||||||
import { createContentIndex } from "~/helpers/create-index.server"
|
import { createContentIndex } from "~/helpers/create-index.server"
|
||||||
import { docsProseClass, linkClass } from "~/styles"
|
import { useScrolled } from "~/hooks/dom/use-scrolled"
|
||||||
|
import { docsProseClass, linkClass, maxWidthContainer } from "~/styles"
|
||||||
|
|
||||||
type LoaderData = ContentIndexEntry[]
|
type LoaderData = ContentIndexEntry[]
|
||||||
|
|
||||||
@@ -19,26 +17,40 @@ export const loader: LoaderFunction = async () => {
|
|||||||
export default function Docs() {
|
export default function Docs() {
|
||||||
const data: LoaderData = useLoaderData()
|
const data: LoaderData = useLoaderData()
|
||||||
return (
|
return (
|
||||||
<HeaderLayout
|
<>
|
||||||
header={<HeaderNav />}
|
<HeaderPanel>
|
||||||
body={
|
<div className={maxWidthContainer}>
|
||||||
<SidebarLayout
|
<MainNavigation />
|
||||||
sidebar={
|
</div>
|
||||||
<SideNav heading="Guides">
|
</HeaderPanel>
|
||||||
|
<main className={clsx(maxWidthContainer, "mt-8 flex items-start gap-4")}>
|
||||||
|
<nav className="w-64 sticky top-24">
|
||||||
|
<h2 className="text-2xl">Guides</h2>
|
||||||
|
<ul className="mt-3 flex flex-col gap-2 items-start">
|
||||||
{data.map(({ title, route }) => (
|
{data.map(({ title, route }) => (
|
||||||
<Link className={linkClass} key={route} to={route}>
|
<li key={route}>
|
||||||
|
<Link className={linkClass} to={route}>
|
||||||
{title}
|
{title}
|
||||||
</Link>
|
</Link>
|
||||||
|
</li>
|
||||||
))}
|
))}
|
||||||
</SideNav>
|
</ul>
|
||||||
}
|
</nav>
|
||||||
body={
|
<section className={clsx(docsProseClass, "pb-8 flex-1 min-w-0")}>
|
||||||
<section className={clsx(docsProseClass, "pb-8")}>
|
|
||||||
<Outlet />
|
<Outlet />
|
||||||
</section>
|
</section>
|
||||||
}
|
</main>
|
||||||
/>
|
</>
|
||||||
}
|
|
||||||
/>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function HeaderPanel({ children }: { children: React.ReactNode }) {
|
||||||
|
const isScrolled = useScrolled()
|
||||||
|
|
||||||
|
const className = clsx(
|
||||||
|
isScrolled ? "bg-slate-700/30" : "bg-slate-800",
|
||||||
|
"shadow-md sticky top-0 backdrop-blur-sm transition z-10 flex",
|
||||||
|
)
|
||||||
|
|
||||||
|
return <header className={className}>{children}</header>
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,13 +1,19 @@
|
|||||||
import packageJson from "reacord/package.json"
|
import packageJson from "reacord/package.json"
|
||||||
import { Link } from "remix"
|
import { Link } from "remix"
|
||||||
import LandingExample from "~/components/landing-example.mdx"
|
import LandingExample from "~/components/landing-example.mdx"
|
||||||
|
import { MainNavigation } from "~/components/main-navigation"
|
||||||
|
import { maxWidthContainer } from "~/styles"
|
||||||
|
|
||||||
export default function Landing() {
|
export default function Landing() {
|
||||||
return (
|
return (
|
||||||
<main className="flex min-w-0 min-h-screen p-4 text-center">
|
<div className="flex flex-col min-w-0 min-h-screen text-center">
|
||||||
<div className="w-full max-w-screen-md px-4 py-6 m-auto space-y-5 rounded-lg shadow-md bg-slate-800">
|
<header className={maxWidthContainer}>
|
||||||
|
<MainNavigation />
|
||||||
|
</header>
|
||||||
|
<div className="pt-0 px-4 pb-8 m-auto">
|
||||||
|
<main className="max-w-screen-md px-4 py-6 m-auto space-y-5 rounded-lg shadow-md bg-slate-800">
|
||||||
<h1 className="text-6xl font-light">reacord</h1>
|
<h1 className="text-6xl font-light">reacord</h1>
|
||||||
<div className="w-full overflow-x-auto">
|
<div className="overflow-x-auto">
|
||||||
<section className="mx-auto text-sm shadow w-fit sm:text-base">
|
<section className="mx-auto text-sm shadow w-fit sm:text-base">
|
||||||
<LandingExample />
|
<LandingExample />
|
||||||
</section>
|
</section>
|
||||||
@@ -19,7 +25,8 @@ export default function Landing() {
|
|||||||
>
|
>
|
||||||
Get Started
|
Get Started
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
|
||||||
</main>
|
</main>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
import clsx from "clsx"
|
import clsx from "clsx"
|
||||||
|
|
||||||
|
export const maxWidthContainer = clsx`
|
||||||
|
mx-auto w-full max-w-screen-lg px-4
|
||||||
|
`
|
||||||
|
|
||||||
export const linkClass = clsx`
|
export const linkClass = clsx`
|
||||||
font-medium inline-block relative
|
font-medium inline-block relative
|
||||||
opacity-60 hover:opacity-100 transition-opacity
|
opacity-60 hover:opacity-100 transition-opacity
|
||||||
|
|||||||
Reference in New Issue
Block a user