feat: add docs section to website (#108)
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { apply, h, tw } from "../client_deps.ts";
|
||||
import {
|
||||
CATEGORIES,
|
||||
TableOfContentsCategory,
|
||||
TableOfContentsCategoryEntry,
|
||||
} from "../data/docs.ts";
|
||||
|
||||
export default function DocsSidebar(props: { path: string }) {
|
||||
return (
|
||||
<ol class={tw`list-decimal list-inside font-semibold` + " nested"}>
|
||||
{CATEGORIES.map((category) => (
|
||||
<SidebarCategory path={props.path} category={category} />
|
||||
))}
|
||||
</ol>
|
||||
);
|
||||
}
|
||||
|
||||
const link = apply`text(gray-900 hover:gray-600)`;
|
||||
const linkActive = apply`text(blue-600 hover:blue-500)`;
|
||||
|
||||
export function SidebarCategory(props: {
|
||||
path: string;
|
||||
category: TableOfContentsCategory;
|
||||
}) {
|
||||
const outerItem = tw`my-2 block`;
|
||||
const innerList = tw`pl-4 list-decimal` + " nested";
|
||||
|
||||
const { title, href, entries } = props.category;
|
||||
const outerLink = tw`${href == props.path ? linkActive : link} font-bold`;
|
||||
|
||||
return (
|
||||
<li class={outerItem}>
|
||||
<a href={href} class={outerLink}>{title}</a>
|
||||
{entries.length > 0 && (
|
||||
<ol class={innerList}>
|
||||
{entries.map((entry) => (
|
||||
<SidebarEntry path={props.path} entry={entry} />
|
||||
))}
|
||||
</ol>
|
||||
)}
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
export function SidebarEntry(props: {
|
||||
path: string;
|
||||
entry: TableOfContentsCategoryEntry;
|
||||
}) {
|
||||
const innerItem = tw`my-0.5`;
|
||||
|
||||
const { title, href } = props.entry;
|
||||
const innerLink = tw`${href == props.path ? linkActive : link} font-normal`;
|
||||
return (
|
||||
<li class={innerItem}>
|
||||
<a href={href} class={innerLink}>{title}</a>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { h, tw } from "../client_deps.ts";
|
||||
|
||||
const LINKS = [
|
||||
{
|
||||
title: "Source",
|
||||
href: "https://github.com/lucacasonato/fresh",
|
||||
},
|
||||
];
|
||||
|
||||
export default function Footer() {
|
||||
const footer = tw
|
||||
`border(t-2 gray-200) bg-gray-100 h-32 flex flex-col gap-4 justify-center`;
|
||||
const inner = tw
|
||||
`mx-auto max-w-screen-lg flex items-center justify-center gap-8`;
|
||||
const linkStyle = tw`text-gray-600 hover:underline`;
|
||||
const copyright = tw`text(gray-600 center)`;
|
||||
return (
|
||||
<footer class={footer}>
|
||||
<div class={inner}>
|
||||
{LINKS.map((link) => (
|
||||
<a href={link.href} class={linkStyle}>
|
||||
{link.title}
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
<div class={copyright}>
|
||||
<span>© {new Date().getFullYear()} the fresh authors</span>
|
||||
</div>
|
||||
</footer>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { h, tw } from "../client_deps.ts";
|
||||
|
||||
export default function NavigationBar(props: { active: string }) {
|
||||
const items = [
|
||||
{
|
||||
name: "Home",
|
||||
href: "/",
|
||||
},
|
||||
{
|
||||
name: "Docs",
|
||||
href: "/docs",
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<nav class={tw`bg(gray-50) py-2 border(t-2 b-2 gray-100)`}>
|
||||
<ul class={tw`flex justify-center gap-8 mx-4`}>
|
||||
{items.map((item) => (
|
||||
<li>
|
||||
<a
|
||||
href={item.href}
|
||||
class={tw`text-gray-600 hover:underline ${
|
||||
props.active == item.href ? "font-bold" : ""
|
||||
}`}
|
||||
>
|
||||
{item.name}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { h, tw } from "../client_deps.ts";
|
||||
|
||||
export default function WarningBanner() {
|
||||
const warning = tw`bg-yellow-100 border(1 yellow-200) p-4 mb-4`;
|
||||
return (
|
||||
<div class={warning}>
|
||||
⚠️ Do not use `fresh` for production usecases yet, unless you are very
|
||||
actively tracking the `fresh` repository for updates. The framework is
|
||||
still undergoing very frequent core functionality changes. You can expect
|
||||
a mostly stable release around the end of March 2022.
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user