-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from CameraKit/develop
Release v3.1.0
- Loading branch information
Showing
33 changed files
with
4,550 additions
and
2,570 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
{ | ||
"presets": ["next/babel"], | ||
"plugins": [ | ||
[ | ||
"module-resolver", | ||
{ | ||
"root": ["./"], | ||
"alias": { | ||
"components": "./components" | ||
} | ||
["module-resolver", { | ||
"root": ["./"], | ||
"alias": { | ||
"components": "./components", | ||
"lib": "./lib", | ||
"static": "./static", | ||
"styles": "./styles", | ||
"utils" : "./utils" | ||
} | ||
] | ||
}] | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
end_of_line = lf | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
max_line_length = 0 | ||
trim_trailing_whitespace = false | ||
[{package.json,*.yml}] | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
node_modules | ||
dist | ||
build |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"parser": "babel-eslint", | ||
"extends": "airbnb", | ||
"rules": { | ||
"react/react-in-jsx-scope": 0, | ||
"react/prop-types": 0, | ||
"react/jsx-filename-extension": 0, | ||
"jsx-a11y/anchor-is-valid": 0 | ||
}, | ||
"env": { | ||
"browser": true, | ||
"node": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
import React from 'react'; | ||
import isomorphicFetch from 'isomorphic-unfetch'; | ||
import { Transition } from 'react-spring'; | ||
|
||
import styles from '../styles/contact-form.scss'; | ||
import intro from '../styles/intro.scss'; | ||
import global from '../styles/styles.global.scss'; | ||
|
||
class ContactForm extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
|
||
this.state = { | ||
success: false, | ||
message: '', | ||
}; | ||
} | ||
|
||
handleSubmit(event) { | ||
event.preventDefault(); | ||
|
||
isomorphicFetch('/processForm', { | ||
method: 'POST', | ||
headers: { | ||
Accept: 'application/json', | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify({ | ||
name: this.name.value, | ||
email: this.email.value, | ||
company: this.company.value, | ||
message: this.message.value, | ||
}), | ||
}).then((response) => { | ||
if (response.ok) { | ||
this.clearInputs(); | ||
this.setState({ success: true, message: 'Thanks. Your message has been recieved. We\'ll get back to you shortly.' }); | ||
} else { | ||
this.setState({ success: false, message: 'Sorry, we could not process your request.' }); | ||
} | ||
}).catch((err) => { | ||
console.error(err); | ||
}); | ||
} | ||
|
||
clearInputs() { | ||
this.name.value = ''; | ||
this.email.value = ''; | ||
this.company.value = ''; | ||
this.message.value = ''; | ||
} | ||
|
||
render() { | ||
const { message, success } = this.state; | ||
|
||
return ( | ||
<section className={styles.intro}> | ||
<div className={`${global.container} ${global['container--large']}`}> | ||
<div className={intro.content}> | ||
<h2 className={`${global['heading--large']} ${intro.subheading}`}> | ||
{'Contact Us'} | ||
</h2> | ||
</div> | ||
</div> | ||
<div className={global.container}> | ||
<Transition | ||
from={{ opacity: 0, height: 0 }} | ||
enter={{ opacity: 1, height: 400 }} | ||
leave={{ opacity: 0, height: 0 }} | ||
> | ||
{success === false | ||
? style => ( | ||
<div style={style}> | ||
<form | ||
className={styles.form} | ||
onSubmit={this.handleSubmit.bind(this)} | ||
> | ||
<div className={styles.container}> | ||
<div className={styles.contactWrapper}> | ||
<input | ||
className={styles.input} | ||
ref={(input) => { this.name = input; }} | ||
placeholder="Name" | ||
name="name" | ||
type="text" | ||
required | ||
/> | ||
</div> | ||
<div className={styles.contactWrapper}> | ||
<input | ||
className={styles.input} | ||
ref={(input) => { this.email = input; }} | ||
placeholder="Email" | ||
name="email" | ||
type="email" | ||
required | ||
/> | ||
</div> | ||
<div className={styles.contactWrapper}> | ||
<input | ||
className={styles.input} | ||
ref={(input) => { this.company = input; }} | ||
placeholder="Company" | ||
name="company" | ||
type="text" | ||
required | ||
/> | ||
</div> | ||
<div className={`${styles.contactWrapper} ${styles.textAreaWrapper}`}> | ||
<textarea | ||
className={`${styles.input} ${styles.textArea}`} | ||
ref={(input) => { this.message = input; }} | ||
placeholder="Message" | ||
name="message" | ||
type="textarea" | ||
required | ||
/> | ||
</div> | ||
<button className={styles.submitButton} type="submit"> | ||
{message && success === false | ||
? 'Try Again' | ||
: 'Submit' | ||
} | ||
</button> | ||
</div> | ||
</form> | ||
</div> | ||
) | ||
|
||
: style => ( | ||
<div style={style}> | ||
<p className={styles.successMessage}> | ||
{message} | ||
</p> | ||
</div> | ||
) | ||
} | ||
</Transition> | ||
</div> | ||
<p className={`${styles.message} ${message && success === false ? styles.show : ''}`}> | ||
{message} | ||
</p> | ||
</section> | ||
); | ||
} | ||
} | ||
|
||
export default ContactForm; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.