my perpetually-unfinished side project; read-it-later but for streaming music.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

52 lines
1.2 KiB

import React from 'react'
import LoginForm from '../LoginForm/LoginForm'
import RegisterForm from '../RegisterForm/RegisterForm'
import './loginorregister.scss'
export default class LoginOrRegister extends React.Component {
constructor(props) {
super(props)
this.state = {register: false}
this.toggle = this.toggle.bind(this)
}
toggle() {
this.setState( (prevState, props) => {
return {register: !prevState.register}
})
}
render() {
return (
<div>
<h1>Watershed Music Player</h1>
<div className="toggle">
<span>
<a
id="login"
className={this.state.register ? "dormant" : "active"}
onClick={this.toggle}
>
Login
</a>
&nbsp;|&nbsp;
<a
id="register"
className={this.state.register ? "active" : "dormant"}
onClick={this.toggle}
>
Register
</a>
</span>
</div>
{this.state.register ?
<RegisterForm submit={this.props.submit} />
:
<LoginForm submit={this.props.submit} />
}
</div>
)
}
}