From 6daab5e176382954d2229d8a9251ae819572a29e Mon Sep 17 00:00:00 2001 From: Wes Bos Date: Wed, 11 Jul 2018 14:57:57 -0400 Subject: more stepped --- stepped-solutions/26/frontend/components/Signup.js | 81 ++++++++++++++++++++++ stepped-solutions/26/frontend/pages/signup.js | 18 +++++ 2 files changed, 99 insertions(+) create mode 100755 stepped-solutions/26/frontend/components/Signup.js create mode 100755 stepped-solutions/26/frontend/pages/signup.js (limited to 'stepped-solutions/26/frontend') diff --git a/stepped-solutions/26/frontend/components/Signup.js b/stepped-solutions/26/frontend/components/Signup.js new file mode 100755 index 0000000..974bc62 --- /dev/null +++ b/stepped-solutions/26/frontend/components/Signup.js @@ -0,0 +1,81 @@ +import React, { Component } from 'react'; +import { Mutation } from 'react-apollo'; +import gql from 'graphql-tag'; +import Form from './styles/Form'; +import Error from './ErrorMessage'; + +const SIGNUP_MUTATION = gql` + mutation SIGNUP_MUTATION($email: String!, $name: String!, $password: String!) { + signup(email: $email, name: $name, password: $password) { + id + email + name + } + } +`; + +class Signup extends Component { + state = { + name: '', + password: '', + email: '', + }; + saveToState = e => { + this.setState({ [e.target.name]: e.target.value }); + }; + render() { + return ( + + {(signup, { error, loading }) => ( +
{ + e.preventDefault(); + await signup(); + this.setState({ name: '', email: '', password: '' }); + }} + > +
+

Sign Up for An Account

+ + + + + + +
+
+ )} +
+ ); + } +} + +export default Signup; diff --git a/stepped-solutions/26/frontend/pages/signup.js b/stepped-solutions/26/frontend/pages/signup.js new file mode 100755 index 0000000..dd90349 --- /dev/null +++ b/stepped-solutions/26/frontend/pages/signup.js @@ -0,0 +1,18 @@ +import Signup from '../components/Signup'; +import styled from 'styled-components'; + +const Columns = styled.div` + display: grid; + grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); + grid-gap: 20px; +`; + +const SignupPage = props => ( + + + + + +); + +export default SignupPage; -- cgit v1.3