Forms!
This commit is contained in:
parent
02d20edce4
commit
de5586d074
27
src/components/FormBlock.js
Normal file
27
src/components/FormBlock.js
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import {
|
||||||
|
Col,
|
||||||
|
FormGroup,
|
||||||
|
Input,
|
||||||
|
Label,
|
||||||
|
} from './Bootstrap';
|
||||||
|
|
||||||
|
export const FormBlock = ({
|
||||||
|
children,
|
||||||
|
label,
|
||||||
|
name,
|
||||||
|
type='text',
|
||||||
|
...props
|
||||||
|
}) => {
|
||||||
|
const formElement = (children !== undefined)
|
||||||
|
? children
|
||||||
|
: <Input id={name} name={name} type={type} {...props} />
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Col xs={12} sm={6} md={3}>
|
||||||
|
<FormGroup>
|
||||||
|
<Label for={name}>{label}</Label>
|
||||||
|
{formElement}
|
||||||
|
</FormGroup>
|
||||||
|
</Col>
|
||||||
|
);
|
||||||
|
};
|
@ -1 +1,2 @@
|
|||||||
export * from './Bootstrap';
|
export * from './Bootstrap';
|
||||||
|
export * from './FormBlock';
|
||||||
|
@ -10,6 +10,8 @@ import {
|
|||||||
Row,
|
Row,
|
||||||
} from '../../components/Bootstrap'
|
} from '../../components/Bootstrap'
|
||||||
|
|
||||||
|
import { FormBlock } from '../../components';
|
||||||
|
|
||||||
export class FilmAddView extends Component {
|
export class FilmAddView extends Component {
|
||||||
constructor (props) {
|
constructor (props) {
|
||||||
super (props);
|
super (props);
|
||||||
@ -23,24 +25,42 @@ export class FilmAddView extends Component {
|
|||||||
return (
|
return (
|
||||||
<Form>
|
<Form>
|
||||||
<Row>
|
<Row>
|
||||||
<Col md={12}>
|
<FormBlock
|
||||||
<FormGroup>
|
label="Brand"
|
||||||
<Label tag="label" for="brand">Brand</Label>
|
name="brand"
|
||||||
<Input type="text" id="brand" name="brand" />
|
required
|
||||||
</FormGroup>
|
/>
|
||||||
<FormGroup>
|
<FormBlock
|
||||||
<Label for="filmFormat">Film Format</Label>
|
label="Film Name"
|
||||||
<select className="custom-select" id="filmFormat" name="filmFormat">
|
name="film-name"
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
<FormBlock
|
||||||
|
label="Film Speed (ISO)"
|
||||||
|
max="6400"
|
||||||
|
name="film-speed-asa"
|
||||||
|
required
|
||||||
|
type="number"
|
||||||
|
/>
|
||||||
|
<FormBlock
|
||||||
|
label="Film Speed (DIN)"
|
||||||
|
name="film-speed-din"
|
||||||
|
type="number"
|
||||||
|
/>
|
||||||
|
<FormBlock
|
||||||
|
label="Film Format"
|
||||||
|
name="film-format"
|
||||||
|
>
|
||||||
|
<select className="custom-select" id="film-format" name="film-format">
|
||||||
<option value="110">110</option>
|
<option value="110">110</option>
|
||||||
<option value="120">120</option>
|
<option value="120">120</option>
|
||||||
<option value="127">127</option>
|
<option value="127">127</option>
|
||||||
<option value="135">135</option>
|
<option value="135">135</option>
|
||||||
</select>
|
</select>
|
||||||
</FormGroup>
|
</FormBlock>
|
||||||
</Col>
|
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
<Col md={12}>
|
<Col xs={12}>
|
||||||
<Button color="primary" type="submit">Save</Button>
|
<Button color="primary" type="submit">Save</Button>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
@ -24,12 +24,12 @@ export const HomeView = (props) => {
|
|||||||
<Container className="App">
|
<Container className="App">
|
||||||
<Row>
|
<Row>
|
||||||
<header className="App-header">
|
<header className="App-header">
|
||||||
<h1>Welcome to Inferno</h1>
|
<h1>Welcome to Film Exif</h1>
|
||||||
</header>
|
</header>
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
<p className="App-intro">
|
<p className="App-intro">
|
||||||
To get started, edit <code>src/App.js</code> and save to reload.
|
Drop files here.
|
||||||
</p>
|
</p>
|
||||||
</Row>
|
</Row>
|
||||||
</Container>
|
</Container>
|
||||||
|
Loading…
Reference in New Issue
Block a user