Skip to content

Commit dbe6f7c

Browse files
committed
Merge pull request #94 from TechnologyAdvice/feature/dynamic-input-wrapper
Fields component and Form examples
2 parents 3c44170 + 921d8f6 commit dbe6f7c

30 files changed

Lines changed: 375 additions & 80 deletions

docs/app/Components/ComponentDoc/ComponentProps.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ export default class ComponentProps extends Component {
1515
};
1616

1717
nameRenderer(item) {
18-
const required = item.required && <span className='ui mini red circular label'>required</span>;
19-
return <div>{item.name} {required}</div>;
18+
const required = item.required && <span className='ui empty mini red circular label' />;
19+
return <code>{item.name} {required}</code>;
2020
}
2121

2222
defaultValueRenderer(item) {
@@ -57,7 +57,7 @@ export default class ComponentProps extends Component {
5757
});
5858

5959
return (
60-
<Segment className='vertical'>
60+
<Segment className='basic vertical'>
6161
<h2 className='ui header'>Props</h2>
6262
<Table data={content} className='very basic'>
6363
<TableColumn dataKey='name' cellRenderer={this.nameRenderer} />
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React, {Component} from 'react';
2+
import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection';
3+
import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample';
4+
5+
export default class FormTypesExamples extends Component {
6+
render() {
7+
return (
8+
<ExampleSection title='Content'>
9+
<ComponentExample
10+
title='Field'
11+
description='A field is a form element containing a label and an input.'
12+
examplePath='collections/Form/Content/FormFieldExample'
13+
/>
14+
</ExampleSection>
15+
);
16+
}
17+
}

docs/app/Examples/collections/Form/content/FormFieldExample.js renamed to docs/app/Examples/collections/Form/Content/FormFieldExample.js

File renamed without changes.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React, {Component} from 'react';
2+
import {Field, Form, Input} from 'stardust';
3+
4+
export default class FormFieldInlineExample extends Component {
5+
render() {
6+
return (
7+
<Form>
8+
<Field label='First name' className='inline'>
9+
<Input placeholder='First name' />
10+
</Field>
11+
</Form>
12+
);
13+
}
14+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React, {Component} from 'react';
2+
import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection';
3+
import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample';
4+
5+
export default class FormFieldVariationsExamples extends Component {
6+
render() {
7+
return (
8+
<ExampleSection title='Field Variations'>
9+
<ComponentExample
10+
title='Inline'
11+
description='A field can have its label next to instead of above it.'
12+
examplePath='collections/Form/FieldVariations/FormFieldInlineExample'
13+
/>
14+
</ExampleSection>
15+
);
16+
}
17+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import React, {Component} from 'react';
2+
import FormContentExamples from './Content/FormContentExamples';
3+
import FormTypesExamples from './Types/FormTypesExamples';
4+
import FormFieldVariationsExamples from './FieldVariations/FormFieldVariationsExamples';
5+
import FormGroupVariationsExamples from './GroupVariations/FormGroupVariationsExamples';
6+
import FormFormVariationsExamples from './FormVariations/FormFormVariationsExamples';
7+
import FormStatesExamples from './States/FormStatesExamples';
8+
9+
export default class FormExamples extends Component {
10+
render() {
11+
return (
12+
<div>
13+
<FormTypesExamples />
14+
<FormContentExamples />
15+
<FormStatesExamples />
16+
<FormFormVariationsExamples />
17+
<FormFieldVariationsExamples />
18+
<FormGroupVariationsExamples />
19+
</div>
20+
);
21+
}
22+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React, {Component} from 'react';
2+
import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection';
3+
import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample';
4+
5+
export default class FormFormVariationsExamples extends Component {
6+
render() {
7+
return (
8+
<ExampleSection title='Form Variations'>
9+
<ComponentExample
10+
title='Size'
11+
description='A form can also be small or large.'
12+
examplePath='collections/Form/FormVariations/FormSizeSmallExample'
13+
/>
14+
<ComponentExample
15+
examplePath='collections/Form/FormVariations/FormSizeLargeExample'
16+
/>
17+
</ExampleSection>
18+
);
19+
}
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React, {Component} from 'react';
2+
import {Button, Field, Fields, Form, Input} from 'stardust';
3+
4+
export default class FormSizeLargeExample extends Component {
5+
render() {
6+
return (
7+
<Form className='large'>
8+
<Fields>
9+
<Field label='First name'>
10+
<Input placeholder='First name' />
11+
</Field>
12+
<Field label='Last name'>
13+
<Input placeholder='Last name' />
14+
</Field>
15+
</Fields>
16+
<Button type='submit'>Submit</Button>
17+
</Form>
18+
);
19+
}
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React, {Component} from 'react';
2+
import {Button, Field, Fields, Form, Input} from 'stardust';
3+
4+
export default class FormSizeSmallExample extends Component {
5+
render() {
6+
return (
7+
<Form className='small'>
8+
<Fields>
9+
<Field label='First name'>
10+
<Input placeholder='First name' />
11+
</Field>
12+
<Field label='Last name'>
13+
<Input placeholder='Last name' />
14+
</Field>
15+
</Fields>
16+
<Button type='submit'>Submit</Button>
17+
</Form>
18+
);
19+
}
20+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React, {Component} from 'react';
2+
import {Field, Fields, Form, Input} from 'stardust';
3+
4+
export default class FormGroupEvenlyDividedExample extends Component {
5+
render() {
6+
return (
7+
<Form>
8+
<Fields evenlyDivided>
9+
<Field label='First name'>
10+
<Input placeholder='First name' />
11+
</Field>
12+
<Field label='Last name'>
13+
<Input placeholder='Last name' />
14+
</Field>
15+
</Fields>
16+
</Form>
17+
);
18+
}
19+
}

0 commit comments

Comments
 (0)