forked from rage/java-programming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsign-up.js
More file actions
53 lines (46 loc) · 1.33 KB
/
Copy pathsign-up.js
File metadata and controls
53 lines (46 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import React from "react"
import Helmet from "react-helmet"
import Layout from "../templates/Layout"
import CreateAccountForm from "../components/user/CreateAccountForm"
import CourseOptionsEditor from "../components/user/CourseOptionsEditor"
import ConfirmEmail from "../components/user/ConfirmEmail"
import LoginStateContext, {
withLoginStateContext,
} from "../contexes/LoginStateContext"
import Container from "../components/Container"
class SignInPage extends React.Component {
static contextType = LoginStateContext
state = {
step: 1,
}
onStepComplete = () => {
this.setState(prevState => ({
step: prevState.step + 1,
}))
if (typeof window !== "undefined") {
window.scrollTo(0, 0)
}
}
render() {
let stepComponent
if (this.state.step === 1) {
stepComponent = <CreateAccountForm onComplete={this.onStepComplete} />
} else if (this.state.step === 2) {
stepComponent = (
<CourseOptionsEditor
courseVariant="nodl"
onComplete={this.onStepComplete}
/>
)
} else {
stepComponent = <ConfirmEmail onComplete={this.onStepComplete} />
}
return (
<Layout>
<Helmet title="Luo käyttäjätunnus" />
<Container>{stepComponent}</Container>
</Layout>
)
}
}
export default withLoginStateContext(SignInPage)