Skip to content

Commit

Permalink
feat: render a comma between multiple args to func definition
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Jun 7, 2020
1 parent 9dd5137 commit 918d6e0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/components/FunctionDefinition.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ const FunctionDefinition = ({ params, returnValue }) => {
</span>
{params.map((param, i) => (
<div key={i} className={styles.param}>
<span className={styles.paramName}>{param.name}: </span>
<span className={styles.type}>{param.type} </span>
{param.name}: <span className={styles.type}>{param.type} </span>
{i !== params.length - 1 && ','}
<Markdown
source={param.description}
renderers={{
Expand Down
5 changes: 1 addition & 4 deletions src/components/FunctionDefinition.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@
}

.param {
margin-left: 1rem;
}

.paramName {
color: var(--color-neutrals-700);
margin-left: 1rem;
}

.paramDescription {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/propTypeInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ export const getTypeMeta = (name, propType, { component }) => {
switch (getRawTypeName(propType)) {
case 'func':
return {
returnValue: propTypeDocs.tags?.returnValue ?? { type: 'undefined' },
params: propTypeDocs.tags?.param ?? [],
returnValue: propTypeDocs?.tags?.returnValue ?? { type: 'undefined' },
params: propTypeDocs?.tags?.param ?? [],
};
case 'shape': {
const [shape] = getArgs(propType);
Expand Down

0 comments on commit 918d6e0

Please sign in to comment.