Olga1108 4 years ago
commit
884a21c68e
44 changed files with 18615 additions and 0 deletions
  1. 1 0
      .eslintcache
  2. 23 0
      .gitignore
  3. 70 0
      README.md
  4. 17185 0
      package-lock.json
  5. 39 0
      package.json
  6. BIN
      public/favicon.ico
  7. 21 0
      public/index.html
  8. 3 0
      public/robots.txt
  9. 38 0
      src/App.css
  10. 19 0
      src/App.js
  11. 8 0
      src/App.test.js
  12. BIN
      src/assets/font/Jost-Medium.ttf
  13. BIN
      src/assets/font/Jost-Regular.ttf
  14. BIN
      src/assets/font/Jost-SemiBold.ttf
  15. 19 0
      src/assets/font/stylesheet.css
  16. 6 0
      src/assets/svg/checked.svg
  17. 2 0
      src/assets/svg/index.js
  18. 9 0
      src/components/Button/Button.jsx
  19. 2 0
      src/components/Button/index.js
  20. 14 0
      src/components/Button/module.scss
  21. 17 0
      src/components/Input/Input.jsx
  22. 2 0
      src/components/Input/index.js
  23. 32 0
      src/components/Input/input.module.scss
  24. 11 0
      src/components/Layout/Layout.jsx
  25. 2 0
      src/components/Layout/index.js
  26. 30 0
      src/components/Layout/layout.module.scss
  27. 82 0
      src/containers/AddressInfo.jsx
  28. 67 0
      src/containers/AvatarStep.jsx
  29. 64 0
      src/containers/PasswordInfo.jsx
  30. 21 0
      src/containers/RegisterUser.jsx
  31. 63 0
      src/containers/UserDetails.jsx
  32. 25 0
      src/containers/completed.jsx
  33. 43 0
      src/containers/formSteps.jsx
  34. 45 0
      src/containers/register-user.module.scss
  35. 55 0
      src/containers/userReducer.js
  36. 46 0
      src/containers/validation.js
  37. 12 0
      src/index.js
  38. 3 0
      src/index.scss
  39. 5 0
      src/setupTests.js
  40. 49 0
      src/styles/_breakpoint.scss
  41. 381 0
      src/styles/_normalize.scss
  42. 19 0
      src/styles/_typography.scss
  43. 6 0
      src/styles/_variables.scss
  44. 76 0
      src/styles/generic.scss

File diff suppressed because it is too large
+ 1 - 0
.eslintcache


+ 23 - 0
.gitignore

@@ -0,0 +1,23 @@
+# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
+
+# dependencies
+/node_modules
+/.pnp
+.pnp.js
+
+# testing
+/coverage
+
+# production
+/build
+
+# misc
+.DS_Store
+.env.local
+.env.development.local
+.env.test.local
+.env.production.local
+
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*

+ 70 - 0
README.md

@@ -0,0 +1,70 @@
+# Getting Started with Create React App
+
+This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
+
+## Available Scripts
+
+In the project directory, you can run:
+
+### `npm start`
+
+Runs the app in the development mode.\
+Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
+
+The page will reload if you make edits.\
+You will also see any lint errors in the console.
+
+### `npm test`
+
+Launches the test runner in the interactive watch mode.\
+See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
+
+### `npm run build`
+
+Builds the app for production to the `build` folder.\
+It correctly bundles React in production mode and optimizes the build for the best performance.
+
+The build is minified and the filenames include the hashes.\
+Your app is ready to be deployed!
+
+See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
+
+### `npm run eject`
+
+**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
+
+If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
+
+Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
+
+You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
+
+## Learn More
+
+You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
+
+To learn React, check out the [React documentation](https://reactjs.org/).
+
+### Code Splitting
+
+This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
+
+### Analyzing the Bundle Size
+
+This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
+
+### Making a Progressive Web App
+
+This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
+
+### Advanced Configuration
+
+This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
+
+### Deployment
+
+This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
+
+### `npm run build` fails to minify
+
+This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)

File diff suppressed because it is too large
+ 17185 - 0
package-lock.json


+ 39 - 0
package.json

@@ -0,0 +1,39 @@
+{
+  "name": "my-form",
+  "version": "0.1.0",
+  "private": true,
+  "dependencies": {
+    "@testing-library/jest-dom": "^5.11.9",
+    "@testing-library/react": "^11.2.3",
+    "@testing-library/user-event": "^12.6.2",
+    "node-sass": "^4.14.1",
+    "react": "^17.0.1",
+    "react-dom": "^17.0.1",
+    "react-scripts": "4.0.1",
+    "web-vitals": "^0.2.4"
+  },
+  "scripts": {
+    "start": "react-scripts start",
+    "build": "react-scripts build",
+    "test": "react-scripts test",
+    "eject": "react-scripts eject"
+  },
+  "eslintConfig": {
+    "extends": [
+      "react-app",
+      "react-app/jest"
+    ]
+  },
+  "browserslist": {
+    "production": [
+      ">0.2%",
+      "not dead",
+      "not op_mini all"
+    ],
+    "development": [
+      "last 1 chrome version",
+      "last 1 firefox version",
+      "last 1 safari version"
+    ]
+  }
+}

BIN
public/favicon.ico


+ 21 - 0
public/index.html

@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="utf-8" />
+    <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
+    <meta name="viewport" content="width=device-width, initial-scale=1" />
+    <meta name="theme-color" content="#000000" />
+    <meta
+      name="description"
+      content="Web site created using create-react-app"
+    />
+    <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
+   
+    <title>React App</title>
+  </head>
+  <body>
+    <noscript>You need to enable JavaScript to run this app.</noscript>
+    <div id="root"></div>
+   
+  </body>
+</html>

+ 3 - 0
public/robots.txt

@@ -0,0 +1,3 @@
+# https://www.robotstxt.org/robotstxt.html
+User-agent: *
+Disallow:

+ 38 - 0
src/App.css

@@ -0,0 +1,38 @@
+.App {
+  text-align: center;
+}
+
+.App-logo {
+  height: 40vmin;
+  pointer-events: none;
+}
+
+@media (prefers-reduced-motion: no-preference) {
+  .App-logo {
+    animation: App-logo-spin infinite 20s linear;
+  }
+}
+
+.App-header {
+  background-color: #282c34;
+  min-height: 100vh;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: center;
+  font-size: calc(10px + 2vmin);
+  color: white;
+}
+
+.App-link {
+  color: #61dafb;
+}
+
+@keyframes App-logo-spin {
+  from {
+    transform: rotate(0deg);
+  }
+  to {
+    transform: rotate(360deg);
+  }
+}

+ 19 - 0
src/App.js

@@ -0,0 +1,19 @@
+import React from 'react'
+import Layout from './components/Layout'
+import RegisterUser from './containers/RegisterUser'
+
+
+
+
+function App() {
+  
+  return (
+    
+    <Layout>
+      <RegisterUser />
+    </Layout>
+    
+  )
+}
+
+export default App;

+ 8 - 0
src/App.test.js

@@ -0,0 +1,8 @@
+import { render, screen } from '@testing-library/react';
+import App from './App';
+
+test('renders learn react link', () => {
+  render(<App />);
+  const linkElement = screen.getByText(/learn react/i);
+  expect(linkElement).toBeInTheDocument();
+});

BIN
src/assets/font/Jost-Medium.ttf


BIN
src/assets/font/Jost-Regular.ttf


BIN
src/assets/font/Jost-SemiBold.ttf


+ 19 - 0
src/assets/font/stylesheet.css

@@ -0,0 +1,19 @@
+@font-face {
+    font-family: Jost;
+    src: url(Jost-Regular.ttf)format('truetype');
+    font-weight: 300;
+    font-style: normal;
+  }
+  @font-face {
+    font-family: Jost;
+    src: url(Jost-Regular.ttf) format('truetype');
+    font-weight: 400;
+    font-style: normal;
+  } 
+  @font-face {
+    font-family: Jost;
+    src: url(Jost-SemiBold.ttf) format('truetype');
+    font-weight: 500;
+    font-style: normal;
+  }
+  

+ 6 - 0
src/assets/svg/checked.svg

@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 408.576 408.576" style="enable-background:new 0 0 408.576 408.576;" xml:space="preserve" width="512px" height="512px" class=""><g><g>
+	<g>
+		<path d="M204.288,0C91.648,0,0,91.648,0,204.288s91.648,204.288,204.288,204.288s204.288-91.648,204.288-204.288    S316.928,0,204.288,0z M318.464,150.528l-130.56,129.536c-7.68,7.68-19.968,8.192-28.16,0.512L90.624,217.6    c-8.192-7.68-8.704-20.48-1.536-28.672c7.68-8.192,20.48-8.704,28.672-1.024l54.784,50.176L289.28,121.344    c8.192-8.192,20.992-8.192,29.184,0C326.656,129.536,326.656,142.336,318.464,150.528z" data-original="#000000" class="active-path" data-old_color="#000000" fill="#03E277"/>
+	</g>
+</g></g> </svg>

+ 2 - 0
src/assets/svg/index.js

@@ -0,0 +1,2 @@
+// export { ReactComponent as Bg } from './bg.svg'
+export { ReactComponent as Success } from './checked.svg'

+ 9 - 0
src/components/Button/Button.jsx

@@ -0,0 +1,9 @@
+import React from 'react'
+import styles from './module.scss'
+
+const Button = ({ type, children,  onClick }) => (
+  <button type={type} onClick={onClick} className={styles.Button}>
+    {children}
+  </button>
+)
+export default Button;

+ 2 - 0
src/components/Button/index.js

@@ -0,0 +1,2 @@
+import Button from './Button'
+export default Button;

+ 14 - 0
src/components/Button/module.scss

@@ -0,0 +1,14 @@
+@import '../../styles/variables';
+Button {
+  width: 100%;
+  font-size: 1rem;
+  cursor: pointer;
+  transition: all 0.2s;
+  touch-action: manipulation;
+  position: relative;
+  padding: 1em 0.8em;
+  line-height: 1.28rem;
+  color: white;
+  border-radius: 3px;
+  background: $primary-color;
+}

+ 17 - 0
src/components/Input/Input.jsx

@@ -0,0 +1,17 @@
+import React from 'react'
+import styles from './input.module.scss'
+
+const Input = ({ label, error, ...rest }) => {
+  return (
+    <div className={styles.Input}>
+      <label>{label}</label>
+      <input {...rest} />
+      {error && (
+        <div>
+          <span className={styles.InputError}> {error}</span>
+        </div>
+      )}
+    </div>
+  )
+}
+export default Input;

+ 2 - 0
src/components/Input/index.js

@@ -0,0 +1,2 @@
+import Input from './Input'
+export default Input;

+ 32 - 0
src/components/Input/input.module.scss

@@ -0,0 +1,32 @@
+@import '../../styles/variables';
+
+.Input {
+  margin-bottom: 0.5em;
+  font-size: 1rem;
+  outline: none;
+  display: grid;
+  justify-content: center;
+  grid-template-columns: 100%;
+  label {
+    font-size: 1em;
+    outline: none;
+  }
+  input {
+    height: 2.5em;
+    padding: 0.4em 0.8em;
+    border-radius: 3px;
+    border: 1px solid $light-grey;
+    font-family: inherit;
+    font-size: 1em;
+    margin-top: 0.5em;
+    &:active,
+    &:focus {
+      border-color: $primary-color;
+      outline: none;
+    }
+  }
+  span {
+    color: $danger;
+    font-size: .85em;
+  }
+}

+ 11 - 0
src/components/Layout/Layout.jsx

@@ -0,0 +1,11 @@
+import React from 'react'
+import styles from './layout.module.scss'
+
+
+export const Layout = ({ children }) => (
+  <div className={styles.Layout}>
+    
+    <div className={styles.LayoutContent}> {children}</div>
+  </div>
+)
+export default Layout;

+ 2 - 0
src/components/Layout/index.js

@@ -0,0 +1,2 @@
+import Layout from './Layout'
+export default Layout;

+ 30 - 0
src/components/Layout/layout.module.scss

@@ -0,0 +1,30 @@
+@import '../../styles/breakpoint';
+@import '../../styles/variables';
+.Layout {
+  background-image: url('https://source.unsplash.com/random');
+  background-repeat: no-repeat;
+  background-size: cover;
+  background-position: 50% 50%;
+  display: block;
+  // height: auto;
+  width: 100%;
+  @include md {
+    display: grid;
+    grid-template-columns: 5fr 4fr;
+    align-items: center;
+    height: 100vh;
+    overflow-y: hidden;
+    font-size: 1rem;
+  }
+  &Content {
+    padding: 0 3em;
+    background: $white;
+    height: 100vh;
+    display: grid;
+    align-items: center;
+    @include sm {
+      padding: 0;
+    }
+  }
+
+}

+ 82 - 0
src/containers/AddressInfo.jsx

@@ -0,0 +1,82 @@
+import React, { useState} from 'react'
+// import GlobalContext from '../App'
+import PropTypes from 'prop-types'
+import styles from './register-user.module.scss'
+import Input from '../components/Input'
+import Button from '../components/Button'
+import { isAddressInfo } from './validation'
+
+const AddressInfo = ({ step, setStep, user, setUser }) => {
+  // const  {state, dispatch } = useContext(GlobalContext);
+  const [errors, setErrors] = useState({})
+  
+
+  const handleAddress = ({ target }) => {
+    setUser({
+      type: 'UPDATE_ADDRESS_INFO',
+      payload: { 
+        [target.name]: target.value },
+    })
+  }
+
+  const handleSubmit = (e) => {
+    e.preventDefault()
+    const errors = isAddressInfo(user)
+    setErrors(errors)
+    if (Object.keys(errors).length > 0) return
+
+    
+
+    setStep(step + 1)
+  }
+
+  return (
+    <form onSubmit={handleSubmit} className={styles.RegisterForm}>
+      <Input
+        type="text"
+        label="Country"
+        name="country"
+        value={user.addressInfo.country}
+        onChange={(e) => handleAddress(e)}
+        error={errors.country}
+      />
+      <Input
+        type="text"
+        label="City"
+        name="city"
+        value={user.addressInfo.city}
+        onChange={(e) => handleAddress(e)}
+        error={errors.city}
+      />
+      <Input
+        type="text"
+        label="Street"
+        name="street"
+        value={user.addressInfo.street}
+        onChange={(e) => handleAddress(e)}
+        error={errors.street}
+      />
+      <Input
+        type="text"
+        label="House"
+        name="house"
+        value={user.addressInfo.house}
+        onChange={(e) => handleAddress(e)}
+        error={errors.house}
+      />
+      <div className={styles.submit}>
+        <Button onClick={() => setStep(step - 1)} type="button">
+          Back
+        </Button>
+        <Button type="submit"> Submit</Button>
+      </div>
+    </form>
+  )
+}
+AddressInfo.propTypes = {
+  step: PropTypes.number,
+  setStep: PropTypes.func,
+  user: PropTypes.object,
+ 
+}
+export default AddressInfo;

+ 67 - 0
src/containers/AvatarStep.jsx

@@ -0,0 +1,67 @@
+import React, { useState } from 'react'
+import PropTypes from 'prop-types'
+import styles from './register-user.module.scss'
+import Input from '../components/Input'
+import Button from '../components/Button'
+// import { isImg } from './validation'
+
+const AvatarStep = ({ step, setStep, user, setUser }) => {
+ 
+  const [imgUrl, setImgUrl] = useState(user.imgUrl || '')
+ 
+
+const uploadImg = (e) => {
+  let reader = new FileReader();
+  let file = e.target.files[0];
+  reader.onloadend = () => {
+    setImgUrl(reader.result)
+  }
+  reader.readAsDataURL(file)
+}
+
+
+  const handleAvatar = ({target}) => {
+  
+
+    setUser({
+      type: 'UPDATE_AVATAR_INFO',
+      payload: { [target.name]: {imgUrl}},
+    })
+  }
+
+  const handleSubmit = (e) => {
+    e.preventDefault()
+   
+     return setStep(step + 1)
+   
+
+    
+  }
+
+  return (
+    <form onSubmit={handleSubmit} className={styles.RegisterForm}>
+      <Input
+        name="imgUrl"
+        type={'file'}
+        
+        onChange={uploadImg}
+        
+      />
+      {imgUrl && <div><img src={imgUrl} height="100" alt="Img"/></div>}
+     
+      <div className={styles.submit}>
+        <Button onClick={() => setStep(step - 1)} type="button">
+          Back
+        </Button>
+        <Button type="submit"> Submit</Button>
+      </div>
+    </form>
+  )
+}
+AvatarStep.propTypes = {
+  step: PropTypes.number,
+  setStep: PropTypes.func,
+  user: PropTypes.object,
+  setUser: PropTypes.func,
+}
+export default AvatarStep;

+ 64 - 0
src/containers/PasswordInfo.jsx

@@ -0,0 +1,64 @@
+import React, { useState } from 'react'
+import PropTypes from 'prop-types'
+import styles from './register-user.module.scss'
+import Input from '../components/Input'
+import Button from '../components/Button'
+import { isPassword } from './validation'
+
+const PasswordInfo = ({ step, setStep, user, setUser }) => {
+  const [errors, setErrors] = useState({})
+  
+
+  const handlePassword = ({ target }) => {
+    setUser({
+      type: 'UPDATE_PASSWORD_INFO',
+      payload: { [target.name]: target.value },
+    })
+  }
+
+  const handleSubmit = (e) => {
+    e.preventDefault()
+    const errors = isPassword(user)
+    setErrors(errors)
+    if (Object.keys(errors).length > 0) return
+
+  
+
+    setStep(step + 1)
+  }
+
+  return (
+    <form onSubmit={handleSubmit} className={styles.RegisterForm}>
+      <Input
+        type="password"
+        label="Password"
+        name="password"
+        value={user.passwordInfo.password}
+        onChange={(e) => handlePassword(e)}
+        error={errors.password}
+      />
+      <Input
+        type="password"
+        label="Confirm password"
+        name="confirm"
+        value={user.passwordInfo.confirm}
+        onChange={(e) => handlePassword(e)}
+        error={errors.confirm}
+      />
+      
+      <div className={styles.submit}>
+        <Button onClick={() => setStep(step - 1)} type="button">
+          Back
+        </Button>
+        <Button type="submit"> Submit</Button>
+      </div>
+    </form>
+  )
+}
+PasswordInfo.propTypes = {
+  step: PropTypes.number,
+  setStep: PropTypes.func,
+  user: PropTypes.object,
+  setUser: PropTypes.func,
+}
+export default PasswordInfo;

+ 21 - 0
src/containers/RegisterUser.jsx

@@ -0,0 +1,21 @@
+import React, { useReducer, useState } from 'react'
+import { UserReducer, DefaultUser } from './userReducer'
+import styles from './register-user.module.scss'
+import FormSteps from './formSteps'
+
+const RegisterUser = () => {
+  let [step, setStep] = useState(0)
+  const [user, setUser] = useReducer(UserReducer, DefaultUser)
+  let steps = FormSteps(step, setStep, user, setUser)
+
+  return (
+    <div className={styles.Register}>
+      <h1>Register User: {steps[`${step}`].title} </h1>
+      <h4>
+        Step {step + 1}/{steps.length}
+      </h4>
+      <div className={styles.RegisterBody}>{steps[`${step}`].content}</div>
+    </div>
+  )
+}
+export default RegisterUser;

+ 63 - 0
src/containers/UserDetails.jsx

@@ -0,0 +1,63 @@
+import React, { useState } from 'react'
+import PropTypes from 'prop-types'
+
+import styles from './register-user.module.scss'
+import Input from '../components/Input'
+import Button from '../components/Button'
+import { isInfo } from './validation'
+
+const UserDetails = ({ step, setStep, user, setUser }) => {
+  
+  const [errors, setErrors] = useState({})
+
+  
+  const handleUser = ({ target }) => {
+    setUser({
+      type: 'UPDATE_PERSONAL_INFO',
+      payload: { [target.name]: target.value },
+    })
+  }
+  const handleContinue = (e) => {
+    e.preventDefault()
+    const errors = isInfo(user)
+    setErrors(errors)
+    if (Object.keys(errors).length > 0) return
+    setStep(step + 1)
+  }
+  return (
+    <form onSubmit={handleContinue} className={styles.RegisterForm}>
+      <Input
+        type="text"
+        name="firstName"
+        value={user.firstName}
+        label="First name"
+        onChange={(e) => handleUser(e)}
+        error={errors.firstName}
+      />
+      <Input
+        type="text"
+        name="lastName"
+        value={user.lastName}
+        label="Last name"
+        onChange={(e) => handleUser(e)}
+        error={errors.lastName}
+      />
+      <Input
+        type="email"
+        label="Email address"
+        name="email"
+        value={user.email}
+        onChange={(e) => handleUser(e)}
+        error={errors.email}
+      />
+      <Button type="submit"> Continue</Button>
+    </form>
+  )
+}
+UserDetails.propTypes = {
+  step: PropTypes.number,
+  setStep: PropTypes.func,
+  user: PropTypes.object,
+  setUser: PropTypes.func,
+}
+export default UserDetails;

+ 25 - 0
src/containers/completed.jsx

@@ -0,0 +1,25 @@
+import React from 'react'
+import PropTypes from 'prop-types'
+import { Success } from '../assets/svg'
+import styles from './register-user.module.scss'
+const Completed = ({ user }) => (
+  <div className={styles.Completed}>
+    <Success />
+    <p>
+      Welcome, <b>{`${user.firstName} ${user.lastName}`}</b>{' '}
+    </p>
+    <p>Email: {`${user.email}`}</p>
+    <p>Country: {`${user.addressInfo.country}`}</p>
+    <p>City: {`${user.addressInfo.city}`}</p>
+    <p>Street: {`${user.addressInfo.street} house: ${user.addressInfo.house}`}</p>
+    <p>Photo: {`${user.avatarStep.imgUrl}`}</p>
+    <p>Your password: {`${user.passwordInfo.password}`}</p>
+    
+    <p> You have successfully registered</p>
+  </div>
+)
+
+Completed.propTypes = {
+  user: PropTypes.object,
+}
+export default Completed

+ 43 - 0
src/containers/formSteps.jsx

@@ -0,0 +1,43 @@
+import React from 'react'
+import UserDetails from './UserDetails'
+import AddressInfo from './AddressInfo';
+import AvatarStep from './AvatarStep';
+import PasswordInfo from './PasswordInfo'
+import Completed from './completed'
+
+const FormSteps = (step, setStep, user, setUser) => [
+  {
+    title: 'Personal Details',
+    content: (
+      <UserDetails
+        setStep={setStep}
+        step={step}
+        user={user}
+        setUser={setUser}
+      />
+    ),
+  },
+  {
+    title: 'Address Information',
+    content: (
+      <AddressInfo setStep={setStep} step={step} user={user} setUser={setUser} />
+    ),
+  },
+  {
+    title: 'Avatar',
+    content: (
+      <AvatarStep setStep={setStep} step={step} user={user} setUser={setUser} />
+    ),
+  }, 
+  {
+    title: 'Password',
+    content: (
+      <PasswordInfo setStep={setStep} step={step} user={user} setUser={setUser} />
+    ),
+  }, 
+  {
+    title: 'Complete',
+    content: <Completed user={user} />,
+  },
+]
+export default FormSteps;

+ 45 - 0
src/containers/register-user.module.scss

@@ -0,0 +1,45 @@
+@import '../styles/variables';
+@import '../styles/breakpoint';
+
+.Register {
+  font-size: 1rem;
+  padding: 0 3em;
+  background: $white;
+  border-radius: 5px;
+  font-family: Jost;
+  @include sm {
+    padding: 0 1em;
+  }
+  h1,
+  h4 {
+    text-align: center;
+  }
+  h1 {
+    font-size: 1.5em;
+  }
+  h4 {
+    padding-bottom: 1.25em;
+    font-size: 1em;
+  }
+
+  &Form {
+    button {
+      margin-top: 1em;
+    }
+    .submit {
+      display: grid;
+      grid-template-columns: repeat(2, 1fr);
+      grid-column-gap: 1.5em;
+      @include sm {
+        grid-column-gap: 1em;
+      }
+    }
+  }
+  .Completed {
+    text-align: center;
+    svg {
+      height: 3em;
+      width: 3em;
+    }
+  }
+}

+ 55 - 0
src/containers/userReducer.js

@@ -0,0 +1,55 @@
+export const DefaultUser = {
+    firstName: '',
+    lastName: '',
+    email: '',
+    addressInfo: {
+      country: '',
+      city: '',
+      street: '',
+      house: '',
+    },
+    avatarStep: {
+      imgUrl: '',
+    },
+    passwordInfo: {
+      password: '',
+      confirm: '',
+    },
+  }
+  
+  export const UserReducer = (user, { type, payload }) => {
+    switch (type) {
+      case 'UPDATE_PERSONAL_INFO':
+        return {
+          ...user,
+          ...payload,
+        }
+      case 'UPDATE_ADDRESS_INFO':
+        return {
+          ...user,
+        addressInfo: {
+          ...user.addressInfo,
+          ...payload,
+        },
+        }
+      case 'UPDATE_AVATAR_INFO':
+        return {
+            ...user,
+            avatarStep: {
+            ...user.avatarStep,
+            ...payload,
+          },
+        }
+        case 'UPDATE_PASSWORD_INFO':
+        return {
+            ...user,
+            passwordInfo: {
+            ...user.passwordInfo,
+            ...payload,
+          },
+        }
+  
+      default:
+        return user
+    }
+  }

+ 46 - 0
src/containers/validation.js

@@ -0,0 +1,46 @@
+export const isInfo = (values) => {
+    let errors = {}
+    if (!values.firstName) {
+      errors.firstName = 'First name is required'
+    }
+    if (!values.lastName) {
+      errors.lastName = 'Last name is required'
+    }
+    
+    if (!values.email) {
+      errors.email = 'Email address is required'
+    } else if (!/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i.test(values.email)) {
+      errors.email = 'Email address is invalid'
+    }
+    return errors
+  }
+  
+  export const isAddressInfo = (values) => {
+    console.log(values.addressInfo.house, values.house)
+    let errors = {}
+    if (!values.addressInfo.country) {
+      errors.country = 'Country is required'
+    }
+    if (!values.addressInfo.city) {
+      errors.city = 'City is required'
+    }
+    if (!values.addressInfo.street) {
+      errors.street = 'Street is required'
+    } 
+    if (!values.addressInfo.house) {
+      errors.house = 'House is required'
+    }
+    return errors
+  }
+
+  export const isPassword = (values) => {
+    let errors = {}
+    if (!values.passwordInfo.password) {
+      errors.password = 'Password is required'
+    }
+    if (!values.passwordInfo.confirm) {
+      errors.confirm = 'Confirm password is required'
+  }
+  return errors
+}
+

+ 12 - 0
src/index.js

@@ -0,0 +1,12 @@
+import React from 'react';
+import ReactDOM from 'react-dom';
+import './index.scss';
+import App from './App';
+
+
+ReactDOM.render(
+  <React.StrictMode>
+    <App />
+  </React.StrictMode>,
+  document.getElementById('root')
+);

+ 3 - 0
src/index.scss

@@ -0,0 +1,3 @@
+body {
+  margin: 0;
+}

+ 5 - 0
src/setupTests.js

@@ -0,0 +1,5 @@
+// jest-dom adds custom jest matchers for asserting on DOM nodes.
+// allows you to do things like:
+// expect(element).toHaveTextContent(/react/i)
+// learn more: https://github.com/testing-library/jest-dom
+import '@testing-library/jest-dom';

+ 49 - 0
src/styles/_breakpoint.scss

@@ -0,0 +1,49 @@
+// Small tablets and large smartphones (landscape view)
+$screen-sm-min: 576px;
+
+// Small tablets (portrait view)
+$screen-md-min: 769px;
+
+// Tablets and small desktops
+$screen-lg-min: 992px;
+
+// Large tablets and desktops
+$screen-xl-min: 1200px;
+
+/**
+ * Breakpoint mixins
+ **/
+// Small devices
+@mixin sm {
+  @media (max-width: #{$screen-sm-min}) {
+    @content;
+  }
+}
+
+// Medium devices
+@mixin md {
+  @media (min-width: #{$screen-md-min}) {
+    @content;
+  }
+}
+
+// Large devices
+@mixin lg {
+  @media (min-width: #{$screen-lg-min}) {
+    @content;
+  }
+}
+
+// Extra large devices
+@mixin xl {
+  @media (min-width: #{$screen-xl-min}) {
+    @content;
+  }
+}
+
+// Custom devices
+@mixin rwd($screen) {
+  @media (min-width: $screen+'px') {
+    @content;
+  }
+}

+ 381 - 0
src/styles/_normalize.scss

@@ -0,0 +1,381 @@
+/*!Based on normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
+
+/* Document
+   ========================================================================== */
+
+/**
+ * 1. Correct the line height in all browsers.
+ * 2. Prevent adjustments of font size after orientation changes in iOS.
+ */
+
+ html {
+    line-height: 1.15;
+    /* 1 */
+    -webkit-text-size-adjust: 100%;
+    /* 2 */
+  }
+  
+  /* Sections
+       ========================================================================== */
+  
+  /**
+     * Remove the margin in all browsers.
+     */
+  
+  body {
+    margin: 0;
+  }
+  
+  /**
+     * Render the `main` element consistently in IE.
+     */
+  
+  main {
+    display: block;
+  }
+  
+  /**
+     * Correct the font size and margin on `h1` elements within `section` and
+     * `article` contexts in Chrome, Firefox, and Safari.
+     */
+  
+  h1 {
+    font-size: 2em;
+    margin: 0.67em 0;
+  }
+  
+  /* Grouping content
+       ========================================================================== */
+  
+  /**
+     * 1. Add the correct box sizing in Firefox.
+     * 2. Show the overflow in Edge and IE.
+     */
+  
+  hr {
+    box-sizing: content-box;
+    /* 1 */
+    height: 0;
+    /* 1 */
+    overflow: visible;
+    /* 2 */
+  }
+  
+  /**
+     * 1. Correct the inheritance and scaling of font size in all browsers.
+     * 2. Correct the odd `em` font sizing in all browsers.
+     */
+  
+  pre {
+    font-family: monospace, monospace;
+    /* 1 */
+    font-size: 1em;
+    /* 2 */
+  }
+  
+  /* Text-level semantics
+       ========================================================================== */
+  
+  /**
+     * Remove the gray background on active links in IE 10.
+     */
+  
+  a {
+    background-color: transparent;
+  }
+  
+  /**
+     * 1. Remove the bottom border in Chrome 57-
+     * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
+     */
+  
+  abbr[title] {
+    border-bottom: none;
+    /* 1 */
+    text-decoration: underline;
+    /* 2 */
+    text-decoration: underline dotted;
+    /* 2 */
+  }
+  
+  /**
+     * Add the correct font weight in Chrome, Edge, and Safari.
+     */
+  
+  b,
+  strong {
+    font-weight: bolder;
+  }
+  
+  /**
+     * 1. Correct the inheritance and scaling of font size in all browsers.
+     * 2. Correct the odd `em` font sizing in all browsers.
+     */
+  
+  code,
+  kbd,
+  samp {
+    font-family: monospace, monospace;
+    /* 1 */
+    font-size: 1em;
+    /* 2 */
+  }
+  
+  /**
+     * Add the correct font size in all browsers.
+     */
+  
+  small {
+    font-size: 80%;
+  }
+  
+  /**
+     * Prevent `sub` and `sup` elements from affecting the line height in
+     * all browsers.
+     */
+  
+  sub,
+  sup {
+    font-size: 75%;
+    line-height: 0;
+    position: relative;
+    vertical-align: baseline;
+  }
+  
+  sub {
+    bottom: -0.25em;
+  }
+  
+  sup {
+    top: -0.5em;
+  }
+  
+  /* Embedded content
+       ========================================================================== */
+  
+  /**
+     * Remove the border on images inside links in IE 10.
+     */
+  
+  img {
+    border-style: none;
+  }
+  
+  /* Forms
+       ========================================================================== */
+  
+  /**
+     * 1. Change the font styles in all browsers.
+     * 2. Remove the margin in Firefox and Safari.
+     */
+  
+  button,
+  input,
+  optgroup,
+  select,
+  textarea {
+    font-family: inherit;
+    /* 1 */
+    font-size: 100%;
+    /* 1 */
+    line-height: 1.15;
+    /* 1 */
+    margin: 0;
+    /* 2 */
+    outline: none;
+  }
+  
+  /**
+     * Show the overflow in IE.
+     * 1. Show the overflow in Edge.
+     */
+  
+  button,
+  input {
+    /* 1 */
+    overflow: visible;
+  }
+  
+  /**
+     * Remove the inheritance of text transform in Edge, Firefox, and IE.
+     * 1. Remove the inheritance of text transform in Firefox.
+     */
+  
+  button,
+  select {
+    /* 1 */
+    text-transform: none;
+  }
+  
+  /**
+     * Correct the inability to style clickable types in iOS and Safari.
+     */
+  
+  button,
+  [type='button'],
+  [type='reset'],
+  [type='submit'] {
+    -webkit-appearance: button;
+    outline: none;
+  }
+  
+  /**
+     * Remove the inner border and padding in Firefox.
+     */
+  
+  button::-moz-focus-inner,
+  [type='button']::-moz-focus-inner,
+  [type='reset']::-moz-focus-inner,
+  [type='submit']::-moz-focus-inner {
+    border-style: none;
+    padding: 0;
+  }
+  
+  /**
+     * Restore the focus styles unset by the previous rule.
+     */
+  
+  button:-moz-focusring,
+  [type='button']:-moz-focusring,
+  [type='reset']:-moz-focusring,
+  [type='submit']:-moz-focusring {
+    outline: 1px dotted ButtonText;
+  }
+  
+  /**
+     * Correct the padding in Firefox.
+     */
+  
+  fieldset {
+    padding: 0.35em 0.75em 0.625em;
+  }
+  
+  /**
+     * 1. Correct the text wrapping in Edge and IE.
+     * 2. Correct the color inheritance from `fieldset` elements in IE.
+     * 3. Remove the padding so developers are not caught out when they zero out
+     *    `fieldset` elements in all browsers.
+     */
+  
+  legend {
+    box-sizing: border-box;
+    /* 1 */
+    color: inherit;
+    /* 2 */
+    display: table;
+    /* 1 */
+    max-width: 100%;
+    /* 1 */
+    padding: 0;
+    /* 3 */
+    white-space: normal;
+    /* 1 */
+  }
+  
+  /**
+     * Add the correct vertical alignment in Chrome, Firefox, and Opera.
+     */
+  
+  progress {
+    vertical-align: baseline;
+  }
+  
+  /**
+     * Remove the default vertical scrollbar in IE 10+.
+     */
+  
+  textarea {
+    overflow: auto;
+  }
+  
+  /**
+     * 1. Add the correct box sizing in IE 10.
+     * 2. Remove the padding in IE 10.
+     */
+  
+  [type='checkbox'],
+  [type='radio'] {
+    box-sizing: border-box;
+    /* 1 */
+    padding: 0;
+    /* 2 */
+  }
+  
+  /**
+     * Correct the cursor style of increment and decrement buttons in Chrome.
+     */
+  
+  [type='number']::-webkit-inner-spin-button,
+  [type='number']::-webkit-outer-spin-button {
+    height: auto;
+  }
+  
+  /**
+     * 1. Correct the odd appearance in Chrome and Safari.
+     * 2. Correct the outline style in Safari.
+     */
+  
+  [type='search'] {
+    -webkit-appearance: textfield;
+    /* 1 */
+    outline-offset: -2px;
+    /* 2 */
+  }
+  
+  /**
+     * Remove the inner padding in Chrome and Safari on macOS.
+     */
+  
+  [type='search']::-webkit-search-decoration {
+    -webkit-appearance: none;
+  }
+  
+  /**
+     * 1. Correct the inability to style clickable types in iOS and Safari.
+     * 2. Change font properties to `inherit` in Safari.
+     */
+  
+  ::-webkit-file-upload-button {
+    -webkit-appearance: button;
+    /* 1 */
+    font: inherit;
+    /* 2 */
+  }
+  
+  /* Interactive
+       ========================================================================== */
+  
+  /*
+     * Add the correct display in Edge, IE 10+, and Firefox.
+     */
+  
+  details {
+    display: block;
+  }
+  
+  /*
+     * Add the correct display in all browsers.
+     */
+  
+  summary {
+    display: list-item;
+  }
+  
+  /* Misc
+       ========================================================================== */
+  
+  /**
+     * Add the correct display in IE 10+.
+     */
+  
+  template {
+    display: none;
+  }
+  
+  /**
+     * Add the correct display in IE 10.
+     */
+  
+  [hidden] {
+    display: none;
+  }

+ 19 - 0
src/styles/_typography.scss

@@ -0,0 +1,19 @@
+@font-face {
+    font-family: Jost;
+    src: url(../assets/font/Jost-Regular.ttf) format('truetype');
+    font-weight: 300;
+    font-style: normal;
+  }
+  @font-face {
+    font-family: Jost;
+    src: url(../assets/font/Jost-Medium.ttf) format('truetype');
+    font-weight: 400;
+    font-style: normal;
+  }
+  
+  @font-face {
+    font-family: Jost;
+    src: url(../assets/font/Jost-SemiBold.ttf) format('truetype');
+    font-weight: 500;
+    font-style: normal;
+  }

+ 6 - 0
src/styles/_variables.scss

@@ -0,0 +1,6 @@
+$white: #ffffff;
+$light-grey: #f0f4f9;
+$primary-color:#2a94f4;
+$bg-blue:#0d538c;
+$danger: #ff5b5b;
+$gradient:linear-gradient(to right top, #2aafe7, #71bfed, #9ed0f2, #c4e1f7, #e7f2fc);

+ 76 - 0
src/styles/generic.scss

@@ -0,0 +1,76 @@
+@import 'variables';
+@import 'breakpoint';
+@import 'normalize';
+@import 'typography';
+
+html {
+  font-size: 62.5%;
+  scroll-behavior: smooth;
+ 
+  @include md {
+    font-size: 75%;
+  }
+
+  @include xl {
+    font-size: 100%;
+  }
+
+  @include rwd(1440) {
+    font-size: 112.5%;
+  }
+
+  @include rwd(2560) {
+    font-size: 200%;
+  }
+}
+
+body {
+  font-family: Jost;
+  -webkit-font-smoothing: antialiased;
+  -moz-osx-font-smoothing: grayscale;
+  box-sizing: border-box;
+  font-style: normal;
+  font-weight: 300;
+  max-width: 2560px;
+  margin: 0 auto;
+  color: #223856;
+  background: $white;
+}
+
+*,
+*::after,
+*::before {
+  margin: 0;
+  padding: 0;
+  box-sizing: inherit;
+  font-style: inherit;
+  font-weight: inherit;
+  font-family: Jost;
+  color: inherit;
+}
+
+button {
+  cursor: pointer;
+
+  &:focus,
+  &:visited,
+  &:active {
+    outline: 0;
+  }
+}
+
+a {
+  text-decoration: none;
+  font-size: inherit;
+  font-weight: inherit;
+  font-style: inherit;
+  color: inherit;
+
+  &:hover {
+    text-decoration: none;
+  }
+}
+
+h1 {
+  margin: 0;
+}