This commit adds support for JSX automatic mode instead of the default mode that requires the presence of the JSX pragma in each file. This commit also adds the config file to the `fresh.gen.ts` manifest, which is used to determine if the client emit should use automatic mode. The minimum Deno version has also been bumped to 1.25.0.
56 lines
1.3 KiB
TypeScript
56 lines
1.3 KiB
TypeScript
import {
|
|
CATEGORIES,
|
|
TableOfContentsCategory,
|
|
TableOfContentsCategoryEntry,
|
|
} from "../data/docs.ts";
|
|
|
|
export default function DocsSidebar(props: { path: string }) {
|
|
return (
|
|
<ol class="list-decimal list-inside font-semibold nested">
|
|
{CATEGORIES.map((category) => (
|
|
<SidebarCategory path={props.path} category={category} />
|
|
))}
|
|
</ol>
|
|
);
|
|
}
|
|
|
|
const link = "text(gray-900 hover:gray-600)";
|
|
const linkActive = "text(green-600 hover:green-500)";
|
|
|
|
export function SidebarCategory(props: {
|
|
path: string;
|
|
category: TableOfContentsCategory;
|
|
}) {
|
|
const { title, href, entries } = props.category;
|
|
|
|
const outerLink = `${href == props.path ? linkActive : link} font-bold`;
|
|
|
|
return (
|
|
<li class="my-2 block">
|
|
<a href={href} class={outerLink}>{title}</a>
|
|
{entries.length > 0 && (
|
|
<ol class="pl-4 list-decimal nested">
|
|
{entries.map((entry) => (
|
|
<SidebarEntry path={props.path} entry={entry} />
|
|
))}
|
|
</ol>
|
|
)}
|
|
</li>
|
|
);
|
|
}
|
|
|
|
export function SidebarEntry(props: {
|
|
path: string;
|
|
entry: TableOfContentsCategoryEntry;
|
|
}) {
|
|
const { title, href } = props.entry;
|
|
|
|
const innerLink = `${href == props.path ? linkActive : link} font-normal`;
|
|
|
|
return (
|
|
<li class="my-0.5">
|
|
<a href={href} class={innerLink}>{title}</a>
|
|
</li>
|
|
);
|
|
}
|