diff --git a/src/components/AuthMenu.js b/src/components/AuthMenu.js new file mode 100644 index 0000000..7fc4e94 --- /dev/null +++ b/src/components/AuthMenu.js @@ -0,0 +1,80 @@ +import React, { Component } from 'react'; + +class AuthMenu extends Component { + constructor (props) { + super(props) + + this.state = { + where_in_auth_menu: "username", + } + + this.handleSignUpRequest = this.handleSignUpRequest.bind(this) + this.handleLogInAttempt = this.handleLogInAttempt.bind(this) + this.handleAccountCreation = this.handleAccountCreation.bind(this) + this.authMenu = this.authMenu.bind(this) + + } + + handleSignUpRequest() { + this.setState(state => ({ + where_in_auth_menu: "email", + auth_menu_visible: true, + })); + } + + handleLogInAttempt() { + this.setState(state => ({ + where_in_auth_menu: "password", + auth_menu_visible: true, + })); + } + handleAccountCreation() { + this.setState(state => ({ + where_in_auth_menu: "password", + auth_menu_visible: true, + })); + } + + authMenu() { + if (!this.props.auth_menu_visible) { + return null; + } + switch(this.state.where_in_auth_menu) { + case 'username': + return ( +