diff --git a/docs/src/components/docs/PropTable.astro b/docs/src/components/docs/PropTable.astro index 485e7f1..d489e0c 100644 --- a/docs/src/components/docs/PropTable.astro +++ b/docs/src/components/docs/PropTable.astro @@ -145,8 +145,10 @@ const { Available when {/* set:text below works around prettier */} {Object.values(conditionData[prop.name]) - .map((value) => ( - + .map(({ condition }) => ( + )) .reduce((previous, current) => [previous, ' or ', current])} diff --git a/docs/src/utils/prop-utils.ts b/docs/src/utils/prop-utils.ts index 9c490c8..b0f17b2 100644 --- a/docs/src/utils/prop-utils.ts +++ b/docs/src/utils/prop-utils.ts @@ -2,9 +2,10 @@ import type { Props as StarlightProps } from '@astrojs/starlight/props'; export type ComponentData = StarlightProps['entry']['data']['componentData']; export type ComponentProp = NonNullable['props'][number]; -export type Condition = NonNullable< - NonNullable['dynamicProps'] ->[number]['condition']; +export type Condition = Omit< + NonNullable['dynamicProps']>[number], + 'props' +>; export type ConditionsRecord = Record; export function uniqueProps( @@ -31,7 +32,10 @@ export function allPropConditions(data: ComponentData): ConditionsRecord { conditionsRecord[prop.name] = []; } - conditionsRecord[prop.name].push(dynamicProp.condition); + conditionsRecord[prop.name].push({ + condition: dynamicProp.condition, + description: dynamicProp.description + }); } }