THE COLOR OF MONEY

This commit is contained in:
Elijah Lucian 2021-07-13 18:10:48 -06:00
parent 49a3fa1d5f
commit ad67de77cc
10 changed files with 39 additions and 67 deletions

View File

@ -12,8 +12,6 @@ import { AppFooter } from './layout/AppFooter'
export const CoreLayout = () => { export const CoreLayout = () => {
const { user } = useUserContext() const { user } = useUserContext()
if (!user) return <Login />
return ( return (
<div className="app"> <div className="app">
<AppHeader> <AppHeader>
@ -24,13 +22,19 @@ export const CoreLayout = () => {
<Link to="/new">New User</Link> <Link to="/new">New User</Link>
</AppHeader> </AppHeader>
<Switch> <main>
<Route path="/users/new" component={NewUser} /> {!user ? (
<Route path="/transactions" component={TransactionList} /> <Login />
<Route path="/accounts/new" component={AccountForm} /> ) : (
<Route path="/accounts" component={AccountForm} /> <Switch>
<Route path="/" component={Dashboard} /> <Route path="/users/new" component={NewUser} />
</Switch> <Route path="/transactions" component={TransactionList} />
<Route path="/accounts/new" component={AccountForm} />
<Route path="/accounts" component={AccountForm} />
<Route path="/" component={Dashboard} />
</Switch>
)}
</main>
<AppFooter /> <AppFooter />
</div> </div>

View File

@ -1,32 +1,16 @@
// @include './form.scss';
.app { .app {
display: grid; display: grid;
grid-template: 1fr / auto 1fr auto; background: #92f322;
grid-template: auto 1fr auto / 1fr;
align-items: center; align-items: center;
font-size: calc(10px + 2vmin);
color: white; color: white;
h1 { h1 {
margin-top: 2.5vmin; margin-top: 2.5vmin;
margin-bottom: 1vmin; margin-bottom: 1vmin;
} }
}
.funds, main {
.transactions {
display: grid;
grid-template-columns: repeat(3, 1fr);
// height: 50vh;
}
.totals {
z-index: 9;
.above {
margin-top: 5ch;
}
.bottom {
margin-bottom: 5ch;
} }
} }

View File

@ -1,9 +1,9 @@
import { useState, useEffect } from 'react' import { useState, useEffect } from 'react'
import { Password, User } from '../../types' import { Password, User } from '../types'
import { useUserContext } from '../../contexts/UserContext' import { useUserContext } from '../contexts/UserContext'
import { message } from 'antd' import { message } from 'antd'
import { Button } from '../../elements/Button' import { Button } from '../elements/Button'
export const UserForm = () => { export const UserForm = () => {
const { user } = useUserContext() const { user } = useUserContext()

View File

@ -1,42 +1,25 @@
@import '~antd/dist/antd.dark.css';
* { * {
box-sizing: border-box; box-sizing: border-box;
} }
#root { #root {
display: flex; display: grid;
flex-direction: column; grid-template: 1fr / 1fr;
height: 100vh; height: 100vh;
} }
.col1 {
grid-column: 1/1;
grid-row: 1/1;
}
.col2 {
grid-column: 2/2;
grid-row: 1/1;
}
.col3 {
grid-column: 3/3;
grid-row: 1/1;
}
h1, h1,
h2, h2,
h3, h3,
h4, h4,
h5 { h5 {
color: #222;
text-shadow: -1px -1px #444;
font-weight: 900; font-weight: 900;
} }
body { body,
html {
font-family: sans-serif;
margin: 0; margin: 0;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }

View File

@ -6,11 +6,11 @@ export const AppFooter = () => {
const { user, selectedAccount } = useUserContext() const { user, selectedAccount } = useUserContext()
return ( return (
<div className="stax-footer"> <footer>
<p>User: {user?.name}</p> <p>User: {user?.name}</p>
<p>|</p> <p>|</p>
<p>Budget: {selectedAccount?.name}</p> <p>Budget: {selectedAccount?.name}</p>
<p>|</p> <p>|</p>
</div> </footer>
) )
} }

View File

@ -1,4 +1,4 @@
.stax-footer { footer {
position: fixed; position: fixed;
left: 0; left: 0;
bottom: 0; bottom: 0;

View File

@ -1,6 +1,5 @@
import { ReactNode } from 'react' import { ReactNode } from 'react'
import { Avatar, Dropdown, Menu } from 'antd' import { Avatar, Dropdown, Menu } from 'antd'
import { Header } from 'antd/lib/layout/layout'
import { Link, useHistory } from 'react-router-dom' import { Link, useHistory } from 'react-router-dom'
import { useUserContext } from '../../contexts/UserContext' import { useUserContext } from '../../contexts/UserContext'
@ -18,14 +17,14 @@ export const AppHeader = ({ children }: Props) => {
// Unauthed Header // Unauthed Header
if (!user) if (!user)
return ( return (
<Header className="stax-header"> <header className="stax-header">
<h3>CashStacks! 💵</h3> <h3>CashStacks! 💵</h3>
</Header> </header>
) )
// Authed Header // Authed Header
return ( return (
<div className="stax-header"> <header>
<div className="header-left"> <div className="header-left">
<Link to="/"> <Link to="/">
<h3>MVP Django React! 🤠</h3> <h3>MVP Django React! 🤠</h3>
@ -52,6 +51,6 @@ export const AppHeader = ({ children }: Props) => {
<Avatar>{user.name[0]}</Avatar> <Avatar>{user.name[0]}</Avatar>
</Dropdown> </Dropdown>
</div> </div>
</div> </header>
) )
} }

View File

@ -1,4 +1,4 @@
.stax-header { header {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
width: 100%; width: 100%;

View File

@ -1,17 +1,20 @@
import { Button, Form, Input } from 'antd' import { Input } from 'antd'
import FormItem from 'antd/lib/form/FormItem' import FormItem from 'antd/lib/form/FormItem'
import { Link } from 'react-router-dom' import { Link } from 'react-router-dom'
import { User } from '../../types' import { User } from '../../types'
import './style.scss' import './style.scss'
import { useUserContext } from '../../contexts/UserContext' import { useUserContext } from '../../contexts/UserContext'
import { Form } from '../../elements/Form'
import { Button } from '../../elements/Button'
import { useForm } from 'antd/lib/form/Form'
type FormValues = Pick<User, 'name'> & { password: string } type FormValues = Pick<User, 'name'> & { password: string }
export const Login = () => { export const Login = () => {
const userContext = useUserContext() const userContext = useUserContext()
const [form] = Form.useForm<FormValues>() const [form] = useForm<FormValues>()
const handleFinish = ({ name, password }: FormValues) => { const handleFinish = ({ name, password }: FormValues) => {
userContext.handleLogin(name, password) userContext.handleLogin(name, password)

View File

@ -2,8 +2,7 @@
display: flex; display: flex;
box-shadow: 5px 5px #111, 2px 2px #111; box-shadow: 5px 5px #111, 2px 2px #111;
flex-direction: column; flex-direction: column;
margin: auto; margin: 0 auto;
background: #222;
border-radius: 0.2rem; border-radius: 0.2rem;
padding: 2rem 2rem; padding: 2rem 2rem;