From d6e2f083bc646214bc214cb14fca39ca4ccf25d6 Mon Sep 17 00:00:00 2001 From: MapleLeaf <19603573+itsMapleLeaf@users.noreply.github.com> Date: Fri, 14 Jan 2022 15:54:10 -0600 Subject: [PATCH] more docks mockuping --- .../app/modules/api/api-data.server.ts | 6 +- packages/website/app/routes/api.tsx | 12 ++-- packages/website/app/routes/api/$name.tsx | 65 +++++++++++++++---- 3 files changed, 60 insertions(+), 23 deletions(-) diff --git a/packages/website/app/modules/api/api-data.server.ts b/packages/website/app/modules/api/api-data.server.ts index a4ab732..ccd67be 100644 --- a/packages/website/app/modules/api/api-data.server.ts +++ b/packages/website/app/modules/api/api-data.server.ts @@ -1,8 +1,8 @@ import type { JSONOutput } from "typedoc" +import apiData from "~/assets/api.json" export type ApiData = JSONOutput.ContainerReflection -export async function loadApiData(): Promise { - const data = await import("~/assets/api.json") - return data as ApiData +export function getApiData(): ApiData { + return apiData as ApiData } diff --git a/packages/website/app/routes/api.tsx b/packages/website/app/routes/api.tsx index f9af1ce..fcdcc81 100644 --- a/packages/website/app/routes/api.tsx +++ b/packages/website/app/routes/api.tsx @@ -2,16 +2,12 @@ import clsx from "clsx" import { Fragment } from "react" import type { LoaderFunction } from "remix" import { Outlet, useLoaderData } from "remix" -import { loadApiData } from "~/modules/api/api-data.server" +import { getApiData } from "~/modules/api/api-data.server" import { ActiveLink } from "~/modules/navigation/active-link" import type { AppLinkProps } from "~/modules/navigation/app-link" import { AppLink } from "~/modules/navigation/app-link" import { MainNavigation } from "~/modules/navigation/main-navigation" -import { - docsProseClass, - linkClass, - maxWidthContainer, -} from "~/modules/ui/components" +import { linkClass, maxWidthContainer } from "~/modules/ui/components" type LoaderData = { categorySections: Array<{ @@ -22,7 +18,7 @@ type LoaderData = { } export const loader: LoaderFunction = async () => { - const apiData = await loadApiData() + const apiData = getApiData() const childrenById = Object.fromEntries( apiData.children.map((child) => [child.id, { name: child.name }]), @@ -73,7 +69,7 @@ export default function ApiReferencePage() { ))} -
+
diff --git a/packages/website/app/routes/api/$name.tsx b/packages/website/app/routes/api/$name.tsx index ba80b54..ab0caf9 100644 --- a/packages/website/app/routes/api/$name.tsx +++ b/packages/website/app/routes/api/$name.tsx @@ -1,21 +1,21 @@ import type { LoaderFunction } from "remix" import { useLoaderData } from "remix" -import { inspect } from "node:util" -import { loadApiData } from "~/modules/api/api-data.server" +import { getApiData } from "~/modules/api/api-data.server" import { renderMarkdown } from "~/modules/markdown/render-markdown.server" +import { docsProseClass } from "~/modules/ui/components" type LoaderData = { title: string description?: { __html: string } + [key: string]: unknown } export const loader: LoaderFunction = async ({ params }) => { - const apiData = await loadApiData() + const apiData = getApiData() const entityName = params.name! const info = apiData.children?.find((child) => child.name === entityName) - console.log(inspect(info, { depth: Number.POSITIVE_INFINITY })) const description = [ info?.comment?.shortText, @@ -29,6 +29,11 @@ export const loader: LoaderFunction = async ({ params }) => { const data: LoaderData = { title: entityName, description: description ? await renderMarkdown(description) : undefined, + sig: await renderMarkdown(` +\`\`\`tsx +function ActionRow(props: ActionRowProps): ReactElement +\`\`\` +`), } return data } @@ -38,14 +43,50 @@ export default function ApiDetailPage() { return ( <> -

{data.title}

- {data.description ? ( -
- ) : undefined} +

{data.title}

+

Component

+
+
+
    +
  • +

    + children?: ReactNode +

    +

    + This should be a list of {` components. +

    +
      +
    • +

      + disabled?: boolean +

      +

      + When true, the select will be slightly faded, and cannot be + interacted with. +

      +
    • +
    +
  • +
  • +

    + minValues?: number +

    +

    + With multiple, the minimum number of values that can + be selected. When multiple is false or not defined, + this is always 1. +

    +

    + This only limits the number of values that can be received by the + user. This does not limit the number of values that can be + displayed by you. +

    +
  • +
+
) } - -function addDefined( - ...values: Array -): Value | undefined {}