From 870c2c2ae87b5ab875fd9f7b6d655f1e5f470777 Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Sat, 3 Jul 2021 15:29:26 -0700 Subject: [PATCH] docs: render component API typedefs (#721) * style(component-api): use flush, condensed structured list for prop table * style(component-api): use small tag variant for reactive props * docs(component-api): render component typedefs --- docs/src/components/ComponentApi.svelte | 28 +++++++++++++++++++------ docs/svelte.config.js | 3 +++ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/docs/src/components/ComponentApi.svelte b/docs/src/components/ComponentApi.svelte index de54abb0..2f131f01 100644 --- a/docs/src/components/ComponentApi.svelte +++ b/docs/src/components/ComponentApi.svelte @@ -4,6 +4,7 @@ slots: [], events: [], rest_props: undefined, + typedefs: [], }; import { @@ -17,6 +18,7 @@ UnorderedList, ListItem, Tag, + CodeSnippet, } from "carbon-components-svelte"; import InlineSnippet from "./InlineSnippet.svelte"; import Launch16 from "carbon-icons-svelte/lib/Launch16"; @@ -40,7 +42,7 @@

- Component source code: + Source code: {component.filePath} @@ -51,9 +53,7 @@ {#if component.props.length > 0}

- + Prop name @@ -71,9 +71,11 @@ {#if prop.reactive}
- Reactive + + Reactive +
{/if} @@ -133,6 +135,20 @@ {:else}

No props.

{/if} + +

Typedefs

+ +{#if component.typedefs.length > 0} + +{:else} +

No typedefs.

+{/if} +

Slots

{#if component.slots.length > 0} diff --git a/docs/svelte.config.js b/docs/svelte.config.js index fbf33fcb..035a51dd 100644 --- a/docs/svelte.config.js +++ b/docs/svelte.config.js @@ -238,6 +238,9 @@ module.exports = {
  • Props
  • +
  • + Typedefs +
  • Slots