-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
feat(Form): update to v1 API #400
Changes from all commits
b2f7ea6
666d5f6
e8c0e6e
ba51bd1
2a91642
f6ab0ed
f52f78b
9227c8d
40f25ca
c54b093
4159614
d992395
2503a44
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ import React from 'react' | |
import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample' | ||
import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection' | ||
|
||
import { Message } from 'src' | ||
|
||
const RadioTypesExamples = () => ( | ||
<ExampleSection title='Types'> | ||
<ComponentExample | ||
|
@@ -23,7 +25,14 @@ const RadioTypesExamples = () => ( | |
title='Radio Group' | ||
description='Radios can be part of a group.' | ||
examplePath='addons/Radio/Types/RadioGroup' | ||
/> | ||
> | ||
<Message warning> | ||
Radios in a group must be | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not aware of the differences between those, though the spaced string did give issues elsewhere. Since space is removed between components that are separated by a new line, and the component's content should always be one space away from adjacent text, I've opted to include |
||
<a href='https://facebook.github.io/react/docs/forms.html#controlled-components' target='_blank'> | ||
controlled components. | ||
</a> | ||
</Message> | ||
</ComponentExample> | ||
</ExampleSection> | ||
) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
import React, { Component } from 'react' | ||
import { Form, Input } from 'stardust' | ||
import React from 'react' | ||
import { Form } from 'stardust' | ||
|
||
export default class FormFieldExample extends Component { | ||
render() { | ||
return ( | ||
<Form> | ||
<Form.Field label='User Input'> | ||
<Input placeholder='User Input' /> | ||
</Form.Field> | ||
</Form> | ||
) | ||
} | ||
} | ||
const FormFieldExample = () => ( | ||
<Form> | ||
<Form.Field> | ||
<label>User Input</label> | ||
<input /> | ||
</Form.Field> | ||
</Form> | ||
) | ||
|
||
export default FormFieldExample |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,14 @@ | ||
import React, { Component } from 'react' | ||
import React from 'react' | ||
import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection' | ||
import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample' | ||
|
||
export default class FormTypesExamples extends Component { | ||
render() { | ||
return ( | ||
<ExampleSection title='Content'> | ||
<ComponentExample | ||
title='Field' | ||
description='A field is a form element containing a label and an input.' | ||
examplePath='collections/Form/Content/FormFieldExample' | ||
/> | ||
</ExampleSection> | ||
) | ||
} | ||
} | ||
const FormTypesExamples = () => ( | ||
<ExampleSection title='Content'> | ||
<ComponentExample | ||
title='Field' | ||
description='A field is a form element containing a label and an input.' | ||
examplePath='collections/Form/Content/FormFieldExample' | ||
/> | ||
</ExampleSection> | ||
) | ||
export default FormTypesExamples |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
import React, { Component } from 'react' | ||
import React from 'react' | ||
import { Form, Input } from 'stardust' | ||
|
||
export default class FormFieldInlineExample extends Component { | ||
render() { | ||
return ( | ||
<Form> | ||
<Form.Field label='First name' className='inline'> | ||
<Input placeholder='First name' /> | ||
</Form.Field> | ||
</Form> | ||
) | ||
} | ||
} | ||
const FormFieldInlineExample = () => ( | ||
<Form> | ||
<Form.Field inline> | ||
<label>First name</label> | ||
<Input placeholder='First name' /> | ||
</Form.Field> | ||
</Form> | ||
) | ||
|
||
export default FormFieldInlineExample |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
import React, { Component } from 'react' | ||
import React from 'react' | ||
import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection' | ||
import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample' | ||
|
||
export default class FormFieldVariationsExamples extends Component { | ||
render() { | ||
return ( | ||
<ExampleSection title='Field Variations'> | ||
<ComponentExample | ||
title='Inline' | ||
description='A field can have its label next to instead of above it.' | ||
examplePath='collections/Form/FieldVariations/FormFieldInlineExample' | ||
/> | ||
</ExampleSection> | ||
) | ||
} | ||
} | ||
const FormFieldVariationsExamples = () => ( | ||
<ExampleSection title='Field Variations'> | ||
<ComponentExample | ||
title='Inline' | ||
description='A field can have its label next to instead of above it.' | ||
examplePath='collections/Form/FieldVariations/FormFieldInlineExample' | ||
/> | ||
</ExampleSection> | ||
) | ||
|
||
export default FormFieldVariationsExamples |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
import React, { Component } from 'react' | ||
import React from 'react' | ||
import { Form, Input } from 'stardust' | ||
|
||
export default class FormGroupEvenlyDividedExample extends Component { | ||
render() { | ||
return ( | ||
<Form> | ||
<Form.Fields evenlyDivided> | ||
<Form.Field label='First name'> | ||
<Input placeholder='First name' /> | ||
</Form.Field> | ||
<Form.Field label='Last name'> | ||
<Input placeholder='Last name' /> | ||
</Form.Field> | ||
</Form.Fields> | ||
</Form> | ||
) | ||
} | ||
} | ||
const FormGroupEvenlyDividedExample = () => ( | ||
<Form> | ||
<Form.Group widths='equal'> | ||
<Form.Field> | ||
<label>First name</label> | ||
<Input placeholder='First name' /> | ||
</Form.Field> | ||
<Form.Field> | ||
<label>Last name</label> | ||
<Input placeholder='Last name' /> | ||
</Form.Field> | ||
</Form.Group> | ||
</Form> | ||
) | ||
|
||
export default FormGroupEvenlyDividedExample |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this to get the function name? If I'm reading it correctly, seems like you could also do:
I could be totally reading this wrong, so ignore if that's the case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are half correct, this is to get the function name. However, the defaultValue here is a json representation of the function from react-docgen. The defaultValue is the actual function stringified.
See
"value": "function formSerializer(formNode) {\n debug('formSerializer...
:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha, makes sense. Thanks for the explanation. Comment resolved.