${esc(title)}
@@ -627,8 +660,8 @@ function renderComponentCard(key: string, c: ComponentManifest, id: string) {
? `
`
: '';
- const warningsBadge = a.hasWarns
- ? `
`
+ const infosBadge = a.hasWarns
+ ? `
`
: '';
const storiesBadge =
@@ -637,8 +670,8 @@ function renderComponentCard(key: string, c: ComponentManifest, id: string) {
: '';
// When there is no prop type error, try to read prop types from reactDocgen if present
- const hasDocgen = !a.hasPropTypeError && 'reactDocgen' in c && c.reactDocgen;
- const parsedDocgen = hasDocgen ? parseReactDocgen(c.reactDocgen) : undefined;
+ const reactDocgen: any = !a.hasPropTypeError && 'reactDocgen' in c && c.reactDocgen;
+ const parsedDocgen = reactDocgen ? parseReactDocgen(reactDocgen) : undefined;
const propEntries = parsedDocgen ? Object.entries(parsedDocgen.props ?? {}) : [];
const propTypesBadge =
!a.hasPropTypeError && propEntries.length > 0
@@ -657,8 +690,10 @@ function renderComponentCard(key: string, c: ComponentManifest, id: string) {
const optional = info?.required ? '' : '?';
const defaultVal = (info?.defaultValue ?? '').trim();
const def = defaultVal ? ` = ${defaultVal}` : '';
- const doc = description ? `/** ${description} */\n` : '';
- return `${doc}${propName}${optional}: ${t}${def}`;
+ const doc =
+ ['/**', ...description.split('\n').map((line) => ` * ${line}`), ' */'].join('\n') +
+ '\n';
+ return `${description ? doc : ''}${propName}${optional}: ${t}${def}`;
})
.join('\n\n')
: '';
@@ -679,7 +714,7 @@ function renderComponentCard(key: string, c: ComponentManifest, id: string) {
@@ -688,7 +723,7 @@ function renderComponentCard(key: string, c: ComponentManifest, id: string) {
${esc(c.name || key)}
${primaryBadge}
- ${warningsBadge}
+ ${infosBadge}
${storiesBadge}
@@ -700,7 +735,7 @@ function renderComponentCard(key: string, c: ComponentManifest, id: string) {
${a.hasPropTypeError ? `
- ${a.warns.map((w) => note('Warning', esc(w), 'warn')).join('')}
+
+ ${a.warns.map((w) => note('Info', esc(w), 'info')).join('')}
`
: ''
}
@@ -730,6 +765,8 @@ function renderComponentCard(key: string, c: ComponentManifest, id: string) {
Prop types
${propEntries.length} ${plural(propEntries.length, 'prop type')}
+