Update, built Contact Page

This commit is contained in:
2018-03-10 21:26:44 +11:00
parent ceb48e104c
commit c24c29c899
33 changed files with 1041 additions and 134 deletions

View File

@ -0,0 +1,41 @@
/*
* Contact Form
* Contact form.
*
* Version:
* 1.0.0 - 2018/03/06
*/
import React from 'react';
import { Form, InputGroup, TextInput } from './Form';
import Button from './../components/Button';
class ContactForm extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<Form className={this.props.className}>
<InputGroup title="Name">
<TextInput placeholder="Enter your name." />
</InputGroup>
<InputGroup title="Email">
<TextInput type="email" placeholder="Enter your email address." />
</InputGroup>
<InputGroup title="Message">
<TextInput multiline placeholder="Enter your message here." />
</InputGroup>
<Button to="/">Home</Button>
<Button submit>Contact</Button>
</Form>
);
}
}
export default ContactForm;

View File

@ -0,0 +1,84 @@
/*
* Form
* Form.
*
* Version:
* 1.0.0 - 2018/03/06
*/
import React from 'react';
//Form
class Form extends React.Component {
constructor(props) {
super(props);
}
render() {
let clazz = "c-form";
if(this.props.className) clazz += " " + this.props.className;
return (
<form className={clazz}>
{this.props.children}
</form>
)
}
}
//InputGroup
class InputGroup extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<div className="c-form__group">
<label className="c-form__label">{this.props.title}</label>
{ this.props.children }
</div>
);
}
}
//Input
class TextInput extends React.Component {
constructor(props) {
super(props);
}
render() {
let element;
let elementType = "input";
let children;
let props = Object.assign({
}, this.props);
let clazz = "c-form-input ";;
if(this.props.multiline) {
elementType = "textarea";
children = this.props.value;
clazz += "c-form-input--multiline ";
delete props.type;
delete props.multiline;
} else {
props.value = this.props.value;
}
if(this.props.className) clazz += this.props.className;
props.className = clazz;
element = React.createElement(
elementType,
props,
children
);
return element;
}
}
export { Form, InputGroup, TextInput };