Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix param of array #1623

Merged
merged 5 commits into from Jul 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/sections/styleguide.config.js
Expand Up @@ -93,8 +93,8 @@ module.exports = {
env === 'development'
? false
: {
maxAssetSize: 1100000, // bytes
maxEntrypointSize: 1100000, // bytes
maxAssetSize: 1150000, // bytes
maxEntrypointSize: 1150000, // bytes
hints: 'error',
},
}),
Expand Down
8 changes: 4 additions & 4 deletions src/client/rsg-components/Argument/Argument.spec.tsx
Expand Up @@ -3,7 +3,7 @@ import { shallow } from 'enzyme';
import { ArgumentRenderer, styles } from './ArgumentRenderer';

const name = 'Foo';
const type = { name: 'Array' };
const type = {type: 'NameExpression', name: 'Array'};
const description = 'Converts foo to bar';
const props = {
classes: classes(styles),
Expand All @@ -28,7 +28,7 @@ it('should render optional argument', () => {
const actual = shallow(
<ArgumentRenderer
{...props}
type={{ type: 'OptionalType', expression: { name: 'Array' } }}
type={{ type: 'OptionalType', expression: {type: 'NameExpression', name: 'Array'} }}
description={description}
/>
);
Expand All @@ -40,7 +40,7 @@ it('should render default value of argument', () => {
const actual = shallow(
<ArgumentRenderer
{...props}
type={{ name: 'String' }}
type={{type: 'NameExpression', name: 'String'}}
default="bar"
description={description}
/>
Expand All @@ -53,7 +53,7 @@ it('should render default value of optional argument', () => {
const actual = shallow(
<ArgumentRenderer
{...props}
type={{ type: 'OptionalType', expression: { name: 'Boolean' } }}
type={{ type: 'OptionalType', expression: {type: 'NameExpression', name: 'Boolean'} }}
default="true"
description={description}
/>
Expand Down
4 changes: 3 additions & 1 deletion src/client/rsg-components/Argument/ArgumentRenderer.tsx
Expand Up @@ -5,6 +5,7 @@ import Markdown from 'rsg-components/Markdown';
import Name from 'rsg-components/Name';
import Type from 'rsg-components/Type';
import Group from 'react-group';
import doctrine from 'doctrine';
import * as Rsg from '../../../typings';

export const styles = ({ space }: Rsg.Theme) => ({
Expand Down Expand Up @@ -38,6 +39,7 @@ export const ArgumentRenderer: React.FunctionComponent<ArgumentPropsWithClasses>
if (isOptional) {
type = type.expression;
}
const typeName = type ? doctrine.type.stringify(type) : '';
const content = (
<Group>
{returns && 'Returns'}
Expand All @@ -49,7 +51,7 @@ export const ArgumentRenderer: React.FunctionComponent<ArgumentPropsWithClasses>
)}
{type && (
<Type>
{type.name}
{typeName}
{isOptional && '?'}
{!!defaultValue && `=${defaultValue}`}
</Type>
Expand Down
4 changes: 2 additions & 2 deletions src/client/rsg-components/Props/Props.spec.tsx
Expand Up @@ -441,7 +441,7 @@ describe('props columns', () => {
{
name: 'Foo',
description: 'Converts foo to bar',
type: { name: 'Array' },
type: {type: 'NameExpression', name: 'Array' },
},
],
param: [
Expand Down Expand Up @@ -479,7 +479,7 @@ describe('props columns', () => {
{
title: 'Foo',
description: 'Returns foo from bar',
type: { name: 'Array' },
type: {type: 'NameExpression', name: 'Array' },
},
],
},
Expand Down
Expand Up @@ -47,7 +47,7 @@ const componentWithEverything: Rsg.Component = {
{
name: 'newValue',
description: 'New value for the counter.',
type: { name: 'Number' },
type: {type: 'NameExpression', name: 'Number' },
},
],
returns: null,
Expand Down