Skip to content

Commit

Permalink
docs: update properties.mdx for icons
Browse files Browse the repository at this point in the history
  • Loading branch information
nmerget committed Apr 10, 2024
1 parent eabfed2 commit 43324e3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
4 changes: 2 additions & 2 deletions packages/components/src/shared/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
25 changes: 17 additions & 8 deletions showcases/patternhub/scripts/get-properties-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,23 @@ const getPropertiesFile = ({ displayName, description, props }) => {
'No description'
} `;
propertyTable += `| ${property.tsType.type ?? property.tsType.name} `;
propertyTable += `| ${
options
? `<pre><code className="code-pre-wrap">${options.replaceAll(
'<T>',
''
)}</code></pre>`
: ''
} |\n`;

if (
propertyKey === 'icon' ||
propertyKey === 'iconAfter' ||
propertyKey === 'messageIcon'
) {
propertyTable += `| [IconTypes](https://db-ui.github.io/mono/review/main/foundations/icons/overview) |\n`;
} else {
propertyTable += `| ${
options
? `<pre><code className="code-pre-wrap">${options.replaceAll(
'<T>',
''
)}</code></pre>`
: ''
} |\n`;
}
}

return `
Expand Down
4 changes: 3 additions & 1 deletion showcases/patternhub/scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}
}
Expand Down

0 comments on commit 43324e3

Please sign in to comment.