From 6c433ce06ec1f69cff6805f454833b3d4a2a711e Mon Sep 17 00:00:00 2001 From: Nicolas Merget <104347736+nmerget@users.noreply.github.com> Date: Thu, 11 Apr 2024 08:50:39 +0200 Subject: [PATCH] docs: update properties.mdx for icons (#2483) --- packages/components/src/shared/model.ts | 4 ++-- .../patternhub/scripts/get-properties-file.js | 21 ++++++++++++------- showcases/patternhub/scripts/utils.js | 4 +++- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/packages/components/src/shared/model.ts b/packages/components/src/shared/model.ts index 8a727eb3940..00cc2782cec 100644 --- a/packages/components/src/shared/model.ts +++ b/packages/components/src/shared/model.ts @@ -58,14 +58,14 @@ export type DefaultVariantProps = { export type IconProps = { /** - * Define an icon by it's identifier (like e.g. _account_, compare to [Icons](https://db-ui.github.io/mono/review/main/foundations/icons) to get displayed in front of the elements content. + * Define an icon by its identifier (like e.g. _account_, compare to [Icons](https://db-ui.github.io/mono/review/main/foundations/icons/overview)) to get displayed in front of the elements content. */ icon?: IconTypes; }; export type IconAfterProps = { /** - * Define an icon by it's identifier (like e.g. _account_, compare to [Icons](https://db-ui.github.io/mono/review/main/foundations/icons) to get displayed in front of the elements content. + * Define an icon by its identifier (like e.g. _account_, compare to [Icons](https://db-ui.github.io/mono/review/main/foundations/icons/overview)) to get displayed in front of the elements content. */ iconAfter?: IconTypes; }; diff --git a/showcases/patternhub/scripts/get-properties-file.js b/showcases/patternhub/scripts/get-properties-file.js index b5676835132..07c582c1474 100644 --- a/showcases/patternhub/scripts/get-properties-file.js +++ b/showcases/patternhub/scripts/get-properties-file.js @@ -60,14 +60,19 @@ const getPropertiesFile = ({ displayName, description, props }) => { 'No description' } `; propertyTable += `| ${property.tsType.type ?? property.tsType.name} `; - propertyTable += `| ${ - options - ? `
${options.replaceAll(
-						'',
-						''
-					)}
` - : '' - } |\n`; + + if (['icon', 'iconAfter', 'messageIcon'].includes(propertyKey)) { + propertyTable += `| [IconTypes](https://db-ui.github.io/mono/review/main/foundations/icons/overview) |\n`; + } else { + propertyTable += `| ${ + options + ? `
${options.replaceAll(
+							'',
+							''
+						)}
` + : '' + } |\n`; + } } return ` diff --git a/showcases/patternhub/scripts/utils.js b/showcases/patternhub/scripts/utils.js index 654b059a100..73aded4e121 100644 --- a/showcases/patternhub/scripts/utils.js +++ b/showcases/patternhub/scripts/utils.js @@ -10,7 +10,9 @@ export const getUnionElements = (options, elements) => { options.push( element.name === 'literal' ? element.value - : getUnionElements(options, element.elements) + : element.elements + ? getUnionElements(options, element.elements) + : element.name ); } }