Skip to content

Commit 18ad904

Browse files
committed
docs: improve style of listing composed components
1 parent f50fae0 commit 18ad904

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

www/src/templates/component.js

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,24 @@ class ComponentTemplate extends React.Component {
7676
<h2 id={`${metadata.displayName}-props`}>
7777
<a href={`#${metadata.displayName}-props`}>Props</a>
7878
{metadata.composes && (
79-
<small style={{ fontStyle: 'italic', fontSize: '70%' }}>
80-
Accepts all props from{' '}
81-
{metadata.composes
82-
.map(p => `<${p.replace('./', '')}>`)
83-
.join(', ')}{' '}
84-
unless otherwise noted.
85-
</small>
79+
<>
80+
{' '}
81+
<small style={{ fontStyle: 'italic', fontSize: '70%' }}>
82+
Accepts all props from{' '}
83+
{metadata.composes
84+
.map(p => (
85+
<code key={p}>{`<${p.replace('./', '')}>`}</code>
86+
))
87+
.reduce((acc, el, i) => {
88+
acc.push(el);
89+
if (i < metadata.composes.length - 1) {
90+
acc.push(', ');
91+
}
92+
return acc;
93+
}, [])}{' '}
94+
unless otherwise noted.
95+
</small>
96+
</>
8697
)}
8798
</h2>
8899
{metadata.props.map(p => this.renderProp(p, metadata.displayName))}

0 commit comments

Comments
 (0)