fix(www): Add a global nav (#895)

This commit is contained in:
hashrock
2022-12-02 01:04:37 +09:00
committed by GitHub
parent 79e9ad017e
commit a0e3b91196
8 changed files with 88 additions and 85 deletions
+2 -4
View File
@@ -1,6 +1,5 @@
import PageFooter from "../components/Footer.tsx";
import DocsHeader from "../components/DocsHeader.tsx";
import NavigationBar from "../components/NavigationBar.tsx";
import Header from "../components/Header.tsx";
import ComponentGallery from "../islands/ComponentGallery.tsx";
import { Head } from "$fresh/runtime.ts";
@@ -42,8 +41,7 @@ export default function Home(props: PageProps<HomeProps>) {
href="https://esm.sh/prismjs@1.27.0/themes/prism-dark.min.css"
/>
</Head>
<DocsHeader title="components" />
<NavigationBar active="/components" />
<Header title="components" active="/components" />
<section class="my-16 px(4 sm:6 md:8) mx-auto max-w-screen-lg space-y-5">
<h2 class="text(3xl gray-600) font-bold">
+28 -6
View File
@@ -2,11 +2,10 @@ import { Head } from "$fresh/runtime.ts";
import { Handlers, PageProps } from "$fresh/server.ts";
import { frontMatter, gfm } from "../../utils/markdown.ts";
import Header from "../../components/Header.tsx";
import DocsTitle from "../../components/DocsTitle.tsx";
import DocsHeader from "../../components/DocsHeader.tsx";
import DocsSidebar from "../../components/DocsSidebar.tsx";
import Footer from "../../components/Footer.tsx";
import NavigationBar from "../../components/NavigationBar.tsx";
import {
SLUGS,
TABLE_OF_CONTENTS,
@@ -66,19 +65,42 @@ export default function DocsPage(props: PageProps<Data>) {
{description && <meta name="description" content={description} />}
</Head>
<div class="flex flex-col min-h-screen">
<DocsHeader title="docs" />
<NavigationBar active="/docs" />
<Header title="docs" active="/docs" />
<Main path={props.url.pathname} page={props.data.page} />
<Footer />
</div>
</>
);
}
import IconBooks from "https://deno.land/x/tabler_icons_tsx@0.0.1/tsx/books.tsx";
function Main(props: { path: string; page: Page }) {
return (
<div class="flex-1">
<MobileSidebar path={props.path} />
<div class="flex mx-auto max-w-screen-lg px-4 py-5 justify-end">
<label
for="docs_sidebar"
class="px-4 py-3 md:hidden flex items-center hover:bg-gray-100 rounded gap-2"
>
<svg
class="h-6 w-6"
stroke="currentColor"
fill="none"
viewBox="0 0 24 24"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
d="M4 6h16M4 12h16M4 18h7"
>
</path>
</svg>
<div>
Menu
</div>
</label>
</div>
<div class="mx-auto max-w-screen-lg px-4 flex gap-6">
<DesktopSidebar path={props.path} />
<Content page={props.page} />
@@ -126,7 +148,7 @@ function DesktopSidebar(props: { path: string }) {
function Content(props: { page: Page }) {
const html = gfm.render(props.page.markdown);
return (
<main class="py-8 overflow-hidden">
<main class="py-6 overflow-hidden">
<h1 class="text(4xl gray-900) tracking-tight font-extrabold mt-6">
{props.page.title}
</h1>
+8 -10
View File
@@ -9,6 +9,7 @@ import CopyArea from "../islands/CopyArea.tsx";
import * as Icons from "../components/Icons.tsx";
import Projects from "../components/Projects.tsx";
import projects from "../data/showcase.json" assert { type: "json" };
import Header from "../components/Header.tsx";
export const handler: Handlers = {
GET(req, ctx) {
@@ -43,9 +44,14 @@ export default function MainPage(props: PageProps) {
<meta property="og:url" content={props.url.href} />
<meta property="og:image" content={ogImageUrl} />
</Head>
<div class="flex flex-col min-h-screen">
<HelloBar />
<Hero />
<div class="bg-green-300 flex flex-col">
<HelloBar />
<Header title="" active="/" />
<Hero />
</div>
<div class="flex-1">
<Intro />
<GettingStarted origin={origin} />
@@ -75,14 +81,6 @@ function HelloBar() {
function Hero() {
return (
<>
<div class="flex justify-end items-center bg-green-300">
<a
href="/docs"
class="border(1 black) inline-flex items-center h-10 px-4 m-4 text-black bg-transparent rounded hover:bg-white"
>
Documentation
</a>
</div>
<section class="w-full flex justify-center items-center flex-col bg-green-300">
<LemonDrop />
</section>
+2 -4
View File
@@ -1,8 +1,7 @@
import { Head } from "$fresh/runtime.ts";
import Projects, { Project } from "../components/Projects.tsx";
import DocsHeader from "../components/DocsHeader.tsx";
import Header from "../components/Header.tsx";
import Footer from "../components/Footer.tsx";
import NavigationBar from "../components/NavigationBar.tsx";
import projects from "../data/showcase.json" assert { type: "json" };
export default function ShowcasePage() {
@@ -11,8 +10,7 @@ export default function ShowcasePage() {
<Head>
<title>Showcase | fresh</title>
</Head>
<DocsHeader title="showcase" />
<NavigationBar active="/showcase" />
<Header title="showcase" active="/showcase" />
<div class="flex flex-col min-h-screen">
<div class="flex-1">