chore: styling for login/signup pages
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import React from "react"
|
||||
import { Link } from "react-router-dom"
|
||||
import { StyledLink as Link } from "../elements"
|
||||
import styled from "@emotion/styled"
|
||||
import { compose } from "recompose"
|
||||
import { withTheme } from "emotion-theming"
|
||||
|
||||
@@ -5,6 +5,7 @@ import { Link } from "react-router-dom"
|
||||
|
||||
import { SIZES } from "../../styles/constants"
|
||||
import Icon from "../Icon"
|
||||
import { H1 } from "../elements"
|
||||
|
||||
const SeekHeader = styled.header`
|
||||
display: flex;
|
||||
@@ -16,11 +17,6 @@ const SeekHeader = styled.header`
|
||||
border-color: ${props => props.theme.colors.quarternary};
|
||||
margin-top: 15px;
|
||||
`
|
||||
const SeekH1 = styled.h1`
|
||||
display: block;
|
||||
font-size: ${SIZES.small};
|
||||
color: ${props => props.theme.colors.secondary};
|
||||
`
|
||||
const SeekArrows = styled.div`
|
||||
display: grid;
|
||||
grid-template-columns: auto auto;
|
||||
@@ -29,7 +25,7 @@ const SeekArrows = styled.div`
|
||||
|
||||
const Seek = ({ title = "", prev = "", next = "", disableNext, theme }) => (
|
||||
<SeekHeader>
|
||||
<SeekH1>{title}</SeekH1>
|
||||
<H1 color={theme.colors.secondary}>{title}</H1>
|
||||
<SeekArrows>
|
||||
<Link to={prev}>
|
||||
<Icon name="ChevronLeft" />
|
||||
|
||||
@@ -1,28 +1,13 @@
|
||||
import React from "react"
|
||||
import { compose } from "recompose"
|
||||
import styled from "@emotion/styled"
|
||||
import { withTheme } from "emotion-theming"
|
||||
|
||||
import { Button } from "../elements"
|
||||
|
||||
import { withFirebase } from "../firebase"
|
||||
|
||||
const Button = styled.button`
|
||||
background-color: ${props => props.theme.colors.headerBackground};
|
||||
padding: 10px 50px;
|
||||
height: 40px;
|
||||
border-radius: 5px;
|
||||
border: 0px solid;
|
||||
border-color: ${props => props.theme.colors.quarternary};
|
||||
color: ${props => props.theme.colors.secondary};
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
background-color: ${props => props.theme.colors.hover};
|
||||
}
|
||||
`
|
||||
|
||||
const SignOutButton = ({ firebase }) => (
|
||||
<Button type="button" onClick={firebase.doSignOut}>
|
||||
const SignOutButton = ({ firebase, theme }) => (
|
||||
<Button colors={theme.colors} type="button" onClick={firebase.doSignOut}>
|
||||
Sign Out
|
||||
</Button>
|
||||
)
|
||||
|
||||
68
src/components/elements/elements.js
Normal file
68
src/components/elements/elements.js
Normal file
@@ -0,0 +1,68 @@
|
||||
import React from "react"
|
||||
import { withTheme } from "emotion-theming"
|
||||
import { Link } from "react-router-dom"
|
||||
import styled from "@emotion/styled"
|
||||
|
||||
import { SIZES } from "../../styles/constants"
|
||||
|
||||
export const H1 = styled.h1`
|
||||
display: block;
|
||||
font-size: ${SIZES.small};
|
||||
color: ${props => props.color};
|
||||
`
|
||||
|
||||
export const Input = styled.input`
|
||||
background-color: ${props => props.colors.headerBackground};
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
max-height: 40px;
|
||||
outline: none;
|
||||
padding: 15px;
|
||||
font-size: ${SIZES.normal};
|
||||
&:focus {
|
||||
box-shadow: 0 0 0 3px ${props => props.colors.bodyBackground},
|
||||
0 0 0 5px ${props => props.colors.hover};
|
||||
}
|
||||
&::placeholder {
|
||||
color: ${props => props.colors.tertiary};
|
||||
}
|
||||
&:valid {
|
||||
border-color: ${props => props.colors.valid} !important;
|
||||
}
|
||||
`
|
||||
|
||||
export const Button = styled.button`
|
||||
display: inline;
|
||||
background-color: ${props => props.colors.headerBackground};
|
||||
padding: 12px 50px;
|
||||
min-height: 45px;
|
||||
border-radius: 5px;
|
||||
border: 0px solid;
|
||||
border-color: ${props => props.colors.quarternary};
|
||||
color: ${props => props.colors.secondary};
|
||||
font-size: ${SIZES.normal};
|
||||
font-weight: 700;
|
||||
outline: none;
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
background-color: ${props => props.colors.hover};
|
||||
}
|
||||
&:focus {
|
||||
box-shadow: 0 0 0 3px ${props => props.colors.bodyBackground},
|
||||
0 0 0 5px ${props => props.colors.hover};
|
||||
}
|
||||
`
|
||||
|
||||
export const P = styled.p`
|
||||
color: ${props => props.colors.secondary};
|
||||
`
|
||||
|
||||
export const StyledLink = withTheme(styled(Link)`
|
||||
text-decoration: none;
|
||||
border-radius: 12px;
|
||||
outline: none;
|
||||
&:focus {
|
||||
box-shadow: 0 0 0 3px ${props => props.theme.colors.bodyBackground},
|
||||
0 0 0 5px ${props => props.theme.colors.hover};
|
||||
}
|
||||
`)
|
||||
1
src/components/elements/index.js
Normal file
1
src/components/elements/index.js
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./elements"
|
||||
@@ -1,19 +1,37 @@
|
||||
import React, { Component } from "react"
|
||||
import { withRouter, Link } from "react-router-dom"
|
||||
import { withRouter } from "react-router-dom"
|
||||
import styled from "@emotion/styled"
|
||||
import { compose } from "recompose"
|
||||
import { format } from "date-fns"
|
||||
import { withTheme } from "emotion-theming"
|
||||
|
||||
import { Input, Button, P } from "../../elements"
|
||||
import { SIZES } from "../../../styles/constants"
|
||||
import { StyledLink as Link } from "../../elements"
|
||||
|
||||
import { FirebaseContext } from "../../firebase"
|
||||
|
||||
const LoginPage = ({ history }) => (
|
||||
<div>
|
||||
<h1>Login</h1>
|
||||
const LoginGrid = styled.div`
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
grid-gap: 10px;
|
||||
`
|
||||
const LoginLayout = styled.div`
|
||||
max-width: ${SIZES.smallWidth};
|
||||
width: 100%;
|
||||
align-self: center;
|
||||
margin-top: 20px;
|
||||
`
|
||||
|
||||
const LoginPage = ({ history, theme }) => (
|
||||
<LoginLayout>
|
||||
<FirebaseContext.Consumer>
|
||||
{firebase => <LoginForm history={history} firebase={firebase} />}
|
||||
</FirebaseContext.Consumer>
|
||||
<p>
|
||||
<P colors={theme.colors} style={{ fontStyle: "italic" }}>
|
||||
Don't have an account? <Link to={"/register"}>Sign Up</Link>
|
||||
</p>
|
||||
</div>
|
||||
</P>
|
||||
</LoginLayout>
|
||||
)
|
||||
|
||||
class LoginFormBase extends Component {
|
||||
@@ -44,37 +62,44 @@ class LoginFormBase extends Component {
|
||||
|
||||
render() {
|
||||
const { email, password, error } = this.state
|
||||
const { theme } = this.props
|
||||
|
||||
const isInvalid = password === "" || email === ""
|
||||
|
||||
return (
|
||||
<form onSubmit={this.onSubmit}>
|
||||
<input
|
||||
name="email"
|
||||
value={email}
|
||||
onChange={this.onChange}
|
||||
type="text"
|
||||
placeholder="Email Address"
|
||||
/>
|
||||
<input
|
||||
name="password"
|
||||
value={password}
|
||||
onChange={this.onChange}
|
||||
type="password"
|
||||
placeholder="Password"
|
||||
/>
|
||||
<button disabled={isInvalid} type="submit">
|
||||
Sign In
|
||||
</button>
|
||||
|
||||
<LoginGrid>
|
||||
<Input
|
||||
name="email"
|
||||
value={email}
|
||||
onChange={this.onChange}
|
||||
type="text"
|
||||
placeholder="Email Address"
|
||||
colors={theme.colors}
|
||||
/>
|
||||
<Input
|
||||
name="password"
|
||||
value={password}
|
||||
onChange={this.onChange}
|
||||
type="password"
|
||||
placeholder="Password"
|
||||
colors={theme.colors}
|
||||
/>
|
||||
<Button colors={theme.colors} disabled={isInvalid} type="submit">
|
||||
Login
|
||||
</Button>
|
||||
</LoginGrid>
|
||||
{error && <p>{error.message}</p>}
|
||||
</form>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
const LoginForm = withRouter(LoginFormBase)
|
||||
const LoginForm = compose(
|
||||
withTheme,
|
||||
withRouter
|
||||
)(LoginFormBase)
|
||||
|
||||
export default LoginPage
|
||||
export default withTheme(LoginPage)
|
||||
|
||||
export { LoginForm }
|
||||
|
||||
@@ -4,6 +4,7 @@ import styled from "@emotion/styled"
|
||||
import {
|
||||
isAfter,
|
||||
isThisYear,
|
||||
isThisMonth,
|
||||
format,
|
||||
addMonths,
|
||||
subMonths,
|
||||
@@ -52,7 +53,7 @@ class Month extends Component {
|
||||
|
||||
let yearCards = []
|
||||
for (let i = 0; i < getDaysInMonth(currentDay); i++) {
|
||||
const isDisabled = dayIndexesToInclude <= i
|
||||
const isDisabled = dayIndexesToInclude <= i && isThisMonth(currentDay)
|
||||
if (isDisabled) {
|
||||
yearCards.push(
|
||||
<YearCard disabled={isDisabled} key={i}>
|
||||
|
||||
@@ -1,18 +1,39 @@
|
||||
import React, { Component } from "react"
|
||||
import { withRouter } from "react-router-dom"
|
||||
import styled from "@emotion/styled"
|
||||
import { compose } from "recompose"
|
||||
import { withTheme } from "emotion-theming"
|
||||
|
||||
import { Input, Button, P } from "../../elements"
|
||||
import { SIZES } from "../../../styles/constants"
|
||||
import { StyledLink as Link } from "../../elements"
|
||||
|
||||
import { FirebaseContext } from "../../firebase"
|
||||
|
||||
const RegisterPage = ({ history }) => (
|
||||
<div>
|
||||
<h1>Register</h1>
|
||||
const RegisterGrid = styled.div`
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
grid-gap: 10px;
|
||||
`
|
||||
const RegisterLayout = styled.div`
|
||||
max-width: ${SIZES.smallWidth};
|
||||
width: 100%;
|
||||
align-self: center;
|
||||
margin-top: 20px;
|
||||
`
|
||||
|
||||
const RegisterPage = ({ history, theme }) => (
|
||||
<RegisterLayout>
|
||||
<FirebaseContext.Consumer>
|
||||
{firebase => <RegisterForm history={history} firebase={firebase} />}
|
||||
</FirebaseContext.Consumer>
|
||||
</div>
|
||||
<P colors={theme.colors} style={{ fontStyle: "italic" }}>
|
||||
Already have an account? <Link to={"/login"}>Login</Link>
|
||||
</P>
|
||||
</RegisterLayout>
|
||||
)
|
||||
|
||||
class RegisterForm extends Component {
|
||||
class RegisterFormBase extends Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
|
||||
@@ -63,6 +84,7 @@ class RegisterForm extends Component {
|
||||
|
||||
render() {
|
||||
const { username, email, passwordOne, passwordTwo, error } = this.state
|
||||
const { theme } = this.props
|
||||
const isInvalid =
|
||||
passwordOne !== passwordTwo ||
|
||||
passwordOne === "" ||
|
||||
@@ -71,37 +93,43 @@ class RegisterForm extends Component {
|
||||
|
||||
return (
|
||||
<form onSubmit={this.onSubmit}>
|
||||
<input
|
||||
name="username"
|
||||
value={username}
|
||||
onChange={this.onChange}
|
||||
type="text"
|
||||
placeholder="Full Name"
|
||||
/>
|
||||
<input
|
||||
name="email"
|
||||
value={email}
|
||||
onChange={this.onChange}
|
||||
type="text"
|
||||
placeholder="Email Address"
|
||||
/>
|
||||
<input
|
||||
name="passwordOne"
|
||||
value={passwordOne}
|
||||
onChange={this.onChange}
|
||||
type="password"
|
||||
placeholder="Password"
|
||||
/>
|
||||
<input
|
||||
name="passwordTwo"
|
||||
value={passwordTwo}
|
||||
onChange={this.onChange}
|
||||
type="password"
|
||||
placeholder="Confirm Password"
|
||||
/>
|
||||
<button disabled={isInvalid} type="submit">
|
||||
Sign Up
|
||||
</button>
|
||||
<RegisterGrid>
|
||||
<Input
|
||||
colors={theme.colors}
|
||||
name="username"
|
||||
value={username}
|
||||
onChange={this.onChange}
|
||||
type="text"
|
||||
placeholder="Full Name"
|
||||
/>
|
||||
<Input
|
||||
colors={theme.colors}
|
||||
name="email"
|
||||
value={email}
|
||||
onChange={this.onChange}
|
||||
type="text"
|
||||
placeholder="Email Address"
|
||||
/>
|
||||
<Input
|
||||
colors={theme.colors}
|
||||
name="passwordOne"
|
||||
value={passwordOne}
|
||||
onChange={this.onChange}
|
||||
type="password"
|
||||
placeholder="Password"
|
||||
/>
|
||||
<Input
|
||||
colors={theme.colors}
|
||||
name="passwordTwo"
|
||||
value={passwordTwo}
|
||||
onChange={this.onChange}
|
||||
type="password"
|
||||
placeholder="Confirm Password"
|
||||
/>
|
||||
<Button colors={theme.colors} disabled={isInvalid} type="submit">
|
||||
Register
|
||||
</Button>
|
||||
</RegisterGrid>
|
||||
|
||||
{error && <p>{error.message}</p>}
|
||||
</form>
|
||||
@@ -109,6 +137,11 @@ class RegisterForm extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
export default withRouter(RegisterPage)
|
||||
const RegisterForm = compose(
|
||||
withTheme,
|
||||
withRouter
|
||||
)(RegisterFormBase)
|
||||
|
||||
export default withTheme(RegisterPage)
|
||||
|
||||
export { RegisterForm }
|
||||
|
||||
Reference in New Issue
Block a user