Personal Dashboard

Login.jsx 1007B

123456789101112131415161718192021222324252627
  1. import React from 'react'
  2. import { Map } from '../../utils'
  3. import firebase from 'firebase'
  4. import { Card, HiddenPassword } from '../../Shared/Components'
  5. import { InputGroup, Button } from '@blueprintjs/core'
  6. import './Login.scss'
  7. const send = e => {
  8. e.preventDefault()
  9. let data = (new Map(new FormData(e.target))).toObj()
  10. firebase.auth().signInWithEmailAndPassword(data.email, data.password)
  11. .catch(e => { console.error(`Firebase auth error: [${e.code}] ${e.message}`) })
  12. }
  13. const Login = () =>
  14. <div className="flex-frame center">
  15. <h1 className="logo"><img src="lighthouse.png"/><span>Lighthouse</span></h1>
  16. <Card>
  17. <form onSubmit={send}>
  18. <InputGroup name="email" placeholder="Email" leftIconName="user"/>
  19. <HiddenPassword name="password" placeholder="Enter your password..." />
  20. <Button iconName="log-in" type="submit">Login</Button>
  21. </form>
  22. </Card>
  23. </div>
  24. export default Login