From 824169fc2512ea0f2b58792d2c33b73ec5633915 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Thu, 19 Mar 2026 13:26:34 -0500 Subject: [PATCH] feat: zooweemama --- .../src/components/ApiDescription.astro | 58 +++++++++++++++++++ .../website-ue/src/components/ApiEntry.astro | 8 +-- .../src/components/ApiMacroSee.astro | 21 +++++++ .../src/components/ApiTester/index.tsx | 20 ++++--- .../src/components/TextField/index.css | 9 +-- .../src/components/TextField/index.tsx | 3 - .../src/pages/api/avatars/[id].json.ts | 4 +- 7 files changed, 97 insertions(+), 26 deletions(-) create mode 100644 packages/website-ue/src/components/ApiDescription.astro create mode 100644 packages/website-ue/src/components/ApiMacroSee.astro diff --git a/packages/website-ue/src/components/ApiDescription.astro b/packages/website-ue/src/components/ApiDescription.astro new file mode 100644 index 000000000..4c1bd06f6 --- /dev/null +++ b/packages/website-ue/src/components/ApiDescription.astro @@ -0,0 +1,58 @@ +--- +import ApiMacroSee from "./ApiMacroSee.astro"; +import { MarkdownCustom } from "./MarkdownCustom"; + +interface Props { + body: string; +} + +const macroPattern = /@(\w+) (.+)/; +const macros: Record = {}; + +const { body: bodyOriginal } = Astro.props; +let body = ""; + +for (const line of bodyOriginal.split("\n")) { + const match = line.match(macroPattern); + + if (match === null) { + body += `${line}\n`; + continue; + } + + const macro = match[1]; + const value = match[2]; + + macros[macro] = value; +} +--- + + + +
+
+
+ + {"see" in macros && } +
+
diff --git a/packages/website-ue/src/components/ApiEntry.astro b/packages/website-ue/src/components/ApiEntry.astro index f1ef9ca8e..2a68462f0 100644 --- a/packages/website-ue/src/components/ApiEntry.astro +++ b/packages/website-ue/src/components/ApiEntry.astro @@ -1,8 +1,8 @@ --- import type { CollectionEntry } from "astro:content"; import { api } from "../core/api/dynamic"; +import ApiDescription from "./ApiDescription.astro"; import { ApiTester } from "./ApiTester"; -import { MarkdownCustom } from "./MarkdownCustom"; interface Props { locale: string; @@ -11,19 +11,17 @@ interface Props { const { locale, api: apiData } = Astro.props; const strings = await api.strings(locale); -const hasSlugs = apiData.id.includes("["); +const body = apiData.data.docs ?? strings.api.no_docs; ---
- - +
diff --git a/packages/website-ue/src/components/ApiMacroSee.astro b/packages/website-ue/src/components/ApiMacroSee.astro new file mode 100644 index 000000000..5e58324f7 --- /dev/null +++ b/packages/website-ue/src/components/ApiMacroSee.astro @@ -0,0 +1,21 @@ +--- +import { Link } from "./Link"; +import { Text } from "./Text"; + +interface Props { + value: string; +} + +const bodyPattern = /^([a-z0-9-\/\.]+) (.+)$/; +const { value } = Astro.props; +const match = value.match(bodyPattern); + +if (match === null) { + throw new Error(`Invalid value for ApiMacroSee: ${value}`); +} + +const path = match[1]; +const message = match[2]; +--- + +See {path} {message} diff --git a/packages/website-ue/src/components/ApiTester/index.tsx b/packages/website-ue/src/components/ApiTester/index.tsx index 44c9ba25d..672df8466 100644 --- a/packages/website-ue/src/components/ApiTester/index.tsx +++ b/packages/website-ue/src/components/ApiTester/index.tsx @@ -1,4 +1,5 @@ -import { useState } from "react"; +import { PlayIcon } from "@radix-ui/react-icons"; +import { Fragment, useState } from "react"; import { LocaleProvider, type LocaleAcceptorProps, @@ -6,8 +7,8 @@ import { import { useStrings } from "../../hooks/useStrings"; import { Button } from "../Button"; import { Code } from "../Code"; -import { Heading } from "../Heading"; import { Link } from "../Link"; +import { Text } from "../Text"; import { TextField } from "../TextField"; import styles from "./index.module.css"; @@ -40,18 +41,17 @@ function Content({ path }: Props) { return (
- + {path.split(slugPattern).map((text, index) => { const slug = slugs[index - 1]; return ( - <> + {index > 0 && ( { @@ -63,14 +63,16 @@ function Content({ path }: Props) { /> )} {text} - + ); })} - + - +
); diff --git a/packages/website-ue/src/components/TextField/index.css b/packages/website-ue/src/components/TextField/index.css index 1ebae7f3d..58caac3b3 100644 --- a/packages/website-ue/src/components/TextField/index.css +++ b/packages/website-ue/src/components/TextField/index.css @@ -11,7 +11,7 @@ box-shadow: var(--shadow-interactive), var(--shadow-cavity); cursor: text; - font-size: var(--font-size-regular); + font: inherit; color: var(--gray-11); &[data-has-icon="true"] { @@ -51,8 +51,7 @@ border: none; cursor: inherit; - font-size: inherit; - font-weight: medium; + font: inherit; padding: var(--space-3) var(--space-4); color: var(--gray-12); @@ -71,9 +70,5 @@ &[data-align="right"] { text-align: right; } - - &[data-monospace="true"] { - font-family: var(--font-family-mono); - } } } diff --git a/packages/website-ue/src/components/TextField/index.tsx b/packages/website-ue/src/components/TextField/index.tsx index b4de99b0f..843766fc1 100644 --- a/packages/website-ue/src/components/TextField/index.tsx +++ b/packages/website-ue/src/components/TextField/index.tsx @@ -13,7 +13,6 @@ import "./index.css"; export interface TextFieldProps extends ComponentProps<"input"> { children?: ReactNode; align?: "left" | "center" | "right"; - monospace?: boolean; autoWidth?: boolean; } @@ -22,7 +21,6 @@ export const TextField = forwardRef( { children, className, - monospace, autoWidth, placeholder, align, @@ -58,7 +56,6 @@ export const TextField = forwardRef( {children} { }) satisfies GetStaticPaths; /** - * Returns data on an avatar based on its id. @see avatars/list.json for a list - * of all avatar ids. + * Returns data on an avatar based on its `id`. * + * @see avatars/list.json for all avatar ids. * @type avatar */ export async function GET({ params }: APIContext) {