diff --git a/packages/i18n/strings/en.json b/packages/i18n/strings/en.json index 794d7ea49..e26334ffc 100644 --- a/packages/i18n/strings/en.json +++ b/packages/i18n/strings/en.json @@ -123,11 +123,6 @@ "media": "Media methods", "no_docs": "This method has no documentation.", "test": "Test", - "view_full": "View full types", - - "macros": { - "see": "See {path} {message}", - "types": "Types:" - } + "view_full": "View full types" } } diff --git a/packages/website-ue/src/components/ApiDescription.astro b/packages/website-ue/src/components/ApiDescription.astro index ad195bbde..dbb20c233 100644 --- a/packages/website-ue/src/components/ApiDescription.astro +++ b/packages/website-ue/src/components/ApiDescription.astro @@ -9,7 +9,12 @@ interface Props { } const macroPattern = /@(\w+) (.+)/; -const macros: Record = {}; +const macros: Record = {}; + +const macroComponents = { + see: ApiMacroSee, + type: ApiMacroType, +}; const { body: bodyOriginal, locale } = Astro.props; let body = ""; @@ -25,7 +30,11 @@ for (const line of bodyOriginal.split("\n")) { const macro = match[1]; const value = match[2]; - macros[macro] = value; + if (macro in macros) { + macros[macro].push(value); + } else { + macros[macro] = [value]; + } } --- @@ -56,7 +65,17 @@ for (const line of bodyOriginal.split("\n")) {
- {"see" in macros && } - {"type" in macros && } + + + { + Object.entries(macroComponents).map(([macro, Component]) => { + if (!(macro in macros)) return null; + + return macros[macro].map((value) => { + return ; + }); + }) + }
diff --git a/packages/website-ue/src/components/ApiMacroSee.astro b/packages/website-ue/src/components/ApiMacroSee.astro index 502eac2f8..f2a694ce6 100644 --- a/packages/website-ue/src/components/ApiMacroSee.astro +++ b/packages/website-ue/src/components/ApiMacroSee.astro @@ -1,7 +1,6 @@ --- import { sluggify } from "@blitzkit/core"; -import { literalsArray } from "@blitzkit/i18n"; -import { api } from "../core/api/dynamic"; +import { Code } from "./Code"; import { Link } from "./Link"; import { Text } from "./Text"; @@ -10,10 +9,9 @@ interface Props { locale: string; } -const bodyPattern = /^([a-z0-9-\/\.]+) (.+)$/; +const bodyPattern = /^([a-z0-9-\/\.\[\]]+) (.+)$/; const { value, locale } = Astro.props; -const strings = await api.strings(locale); const match = value.match(bodyPattern); @@ -26,10 +24,13 @@ const message = match[2]; --- - { - literalsArray(strings.api.macros.see, { - path: {path}, - message, - }) - } + + @see + + + + {path} + + + {message} diff --git a/packages/website-ue/src/components/ApiMacroType.astro b/packages/website-ue/src/components/ApiMacroType.astro index 17c6d867e..11d64b8e9 100644 --- a/packages/website-ue/src/components/ApiMacroType.astro +++ b/packages/website-ue/src/components/ApiMacroType.astro @@ -5,6 +5,8 @@ import { Link } from "./Link"; import { api } from "../core/api/dynamic"; import HighlightedCodeBlock from "./HighlightedCodeBlock.astro"; import { Text } from "./Text"; +import { ArrowBottomRightIcon } from "@radix-ui/react-icons"; +import { Code } from "./Code"; interface Props { value: string; @@ -73,6 +75,14 @@ stripped = stripped.replaceAll(" ", " "); ---