Skip to content

Commit

Permalink
Footer and app container now support theme
Browse files Browse the repository at this point in the history
  • Loading branch information
drewwebs committed Jan 25, 2021
1 parent 9ec2ed0 commit 72b671e
Show file tree
Hide file tree
Showing 9 changed files with 253 additions and 80 deletions.
2 changes: 1 addition & 1 deletion app/assets/stylesheets/nav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
margin-left: 16px;
margin-right: 16px;
padding-bottom: 4px;
color: #1d1c23;
color: inherit;
text-decoration: none;
font-size: 18px;
transition: border-bottom ease 2s;
Expand Down
19 changes: 0 additions & 19 deletions app/assets/stylesheets/reset.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,4 @@ table {

a:hover{
cursor: pointer;
}

.app-container {
display: flex;
flex-direction: column;
justify-content: space-between;
background-color: #fef9f8;
min-height: 100%;
font-family: "Roboto", "Helvetica", "Arial", sans-serif;
position: relative;

&::-webkit-scrollbar {
display: none;
}

.component{
flex-grow: 1;
display: flex;
}
}
2 changes: 1 addition & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
t.integer "start_date"
t.string "end_date"
t.text "notes"
t.boolean "tips"
t.string "pay_frequency", null: false
t.boolean "tips"
t.float "avg_tips"
t.integer "satisfaction"
t.index ["position"], name: "index_reviews_on_position"
Expand Down
65 changes: 38 additions & 27 deletions frontend/components/App.jsx
Original file line number Diff line number Diff line change
@@ -1,45 +1,56 @@
import React from 'react'
import Splash from './splash/splash'
import { Route, Switch } from 'react-router-dom';
import Form from './reviews/Form';
import Nav from './nav/nav'
import ReviewIndex from './reviews/Index';
import ShopSearch from './reviews/ShopSearch';
import ErrorReport from './contact/error_report';
import NewReview from './reviews/NewReview';
import Footer from './footer/Footer';
import Auth from './auth/Auth';
import { AuthRoute } from '../util/route_util';
import Graphs from './chart/chart';
import theme from 'styled-theming';
import { ThemeProvider } from 'styled-components';
import DarkThemeProvider from './DarkThemeProvider';
import styled from 'styled-components';
import { backgroundColor, textColor } from './DarkThemeProvider';

export const backgroundColor = theme("theme", {
light: "#fef9f8",
dark: "#15202B"
});
const Container = styled.div`
display: flex;
flex-direction: column;
justify-content: space-between;
background-color: ${backgroundColor};
color: ${textColor};
min-height: 100%;
font-family: "Roboto", "Helvetica", "Arial", sans-serif;
position: relative;
export const textColor = theme("theme", {
light: "#ffffff",
dark: "#000000"
});
&::-webkit-scrollbar {
display: none;
}
`;

const Component = styled.div`
flex-grow: 1;
display: flex;
`;

export default function App() {
return (
<div className="app-container">
<Nav/>
<div className='component'>
<Switch>
<Route path='/new_review' component={Splash} />
<Route path='/create_review' component={NewReview} />
<Route path='/reviews' component={ReviewIndex} />
<Route path='/feedback' component={ErrorReport} />
<AuthRoute path='/admin' component={Auth} />
<Route exact path='/' component={Splash}/>
</Switch>
</div>
<Footer />
</div>
<DarkThemeProvider>
<Container>
<Nav/>
<Component>
<Switch>
<Route path='/new_review' component={Splash} />
<Route path='/create_review' component={NewReview} />
<Route path='/reviews' component={ReviewIndex} />
<Route path='/feedback' component={ErrorReport} />
<AuthRoute path='/admin' component={Auth} />
<Route exact path='/' component={Splash}/>
</Switch>
</Component>
<Footer />
</Container>
</DarkThemeProvider>


);
}
37 changes: 37 additions & 0 deletions frontend/components/DarkThemeProvider.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React from "react";
import { useSelector } from "react-redux";
import { ThemeProvider } from "styled-components";
import theme from 'styled-theming';


export const backgroundColor = theme("theme", {
light: "#fef9f8",
dark: "#15202B"
});

export const textColor = theme("theme", {
light: "#000000",
dark: "#ffffff"
});

export const buttonColor = theme("theme", {
light: "#A9A9A9",
dark: "#D3D3D3"
});

export const footerColor = theme("theme", {
light: "#404040",
dark: "#22303C"
});

const DarkThemeProvider = ({ children }) => {
const darkThemeEnabled = useSelector((state) => state.theme.darkThemeEnabled);
return (
<ThemeProvider theme={{ theme: darkThemeEnabled ? "dark" : "light" }}>
{children}
</ThemeProvider>
);
};


export default DarkThemeProvider;
113 changes: 82 additions & 31 deletions frontend/components/footer/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,59 +2,110 @@ import React from 'react';
import LinkedInIcon from '@material-ui/icons/LinkedIn';
import GitHubIcon from '@material-ui/icons/GitHub';
import LanguageIcon from '@material-ui/icons/Language';
import WbIncandescentIcon from '@material-ui/icons/WbIncandescent';
import { useDispatch } from 'react-redux';
import { toggleDarktheme } from '../../actions/theme_actions';
import { buttonColor, footerColor } from '../DarkThemeProvider';
import styled from 'styled-components';

const source = 'https://docs.google.com/spreadsheets/d/1oE2avtfGQRuSI1-gltcIw-AazA3ov3dEoX-sTbPI6Jw/edit?fbclid=IwAR1T3ttg8PBZ2Ppi5w2J2R1UfUtF6h3eYUM6u7u6xIte9qdtHUz6T12unIc#gid=0';

const Anchor = styled.a`
color: ${buttonColor}
`;

const Foot = styled.footer`
display: flex;
justify-content: space-between;
align-items: center;
padding: 40px;
background: ${footerColor};
width: 100%;
box-sizing: border-box;
&-site-explanation {
width: 40%
}
&-personal-info {
display: flex;
width: 40%;
justify-content: space-between;
& > div {
display: flex;
flex-direction: column;
justify-content: center;
width: 102px;
}
& span {
text-align: center;
}
&-links {
display: flex;
justify-content: space-between;
}
}
`;

export default function Footer() {
const source = 'https://docs.google.com/spreadsheets/d/1oE2avtfGQRuSI1-gltcIw-AazA3ov3dEoX-sTbPI6Jw/edit?fbclid=IwAR1T3ttg8PBZ2Ppi5w2J2R1UfUtF6h3eYUM6u7u6xIte9qdtHUz6T12unIc#gid=0';
const dispatch = useDispatch();

return (
<footer className="footer">
<Foot>
<div className='footer-site-explanation'>
Initial seed data pulled from <a href={source} target='_blank'>2019 wage transparency spreadsheets</a>
Initial seed data pulled from <Anchor href={source} target='_blank'>2019 wage transparency spreadsheets</Anchor>
</div>
<a onClick={() => dispatch(toggleDarktheme())}>
<WbIncandescentIcon />
</a>
<div className='footer-personal-info'>
<div>
<div className='footer-personal-info-links'>
<a href="https://github.com/drewwebs">
<GitHubIcon color='action' />
</a>
<a href="https://www.linkedin.com/in/drew-webster-4261a934/">
<LinkedInIcon color='action' />
</a>
<a href="https://drewwebster.dev">
<LanguageIcon color='action' />
</a>
<Anchor href="https://github.com/drewwebs">
<GitHubIcon />
</Anchor>
<Anchor href="https://www.linkedin.com/in/drew-webster-4261a934/">
<LinkedInIcon />
</Anchor>
<Anchor href="https://drewwebster.dev">
<LanguageIcon />
</Anchor>
</div>
<span>Drew Webster</span>
</div>
<div>
<div className='footer-personal-info-links'>
<a href="https://github.com/allsouza">
<GitHubIcon color='action' />
</a>
<a href="https://www.linkedin.com/in/andre-souza-2ab6a3155/">
<LinkedInIcon color='action' />
</a>
<a href="https://allsouza.github.io/">
<LanguageIcon color='action' />
</a>
<Anchor href="https://github.com/allsouza">
<GitHubIcon />
</Anchor>
<Anchor href="https://www.linkedin.com/in/andre-souza-2ab6a3155/">
<LinkedInIcon />
</Anchor>
<Anchor href="https://allsouza.github.io/">
<LanguageIcon />
</Anchor>
</div>
<span>Andre Souza</span>
</div>
<div>
<div className='footer-personal-info-links'>
<a href="https://github.com/bradlarsoncode">
<GitHubIcon color='action' />
</a>
<a href="https://www.linkedin.com/in/bradlarsoncode/">
<LinkedInIcon color='action' />
</a>
<a href="http://www.bradlarson.me/">
<LanguageIcon color='action' />
</a>
<Anchor href="https://github.com/bradlarsoncode">
<GitHubIcon />
</Anchor>
<Anchor href="https://www.linkedin.com/in/bradlarsoncode/">
<LinkedInIcon />
</Anchor>
<Anchor href="http://www.bradlarson.me/">
<LanguageIcon />
</Anchor>
</div>
<span>Brad Larson</span>
</div>
</div>
</footer>
</Foot>
)
}
2 changes: 1 addition & 1 deletion frontend/reducers/theme_reducer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TOGGLE_DARKTHEME } from '../actions/theme_actions';

export const themeReducer = (state = { darkThemeEnabled: false }, action) => {
export default function themeReducer (state = { darkThemeEnabled: false }, action) {
switch (action.type) {
case TOGGLE_DARKTHEME:
return {...state, darkThemeEnabled: !state.darkThemeEnabled}
Expand Down
Loading

0 comments on commit 72b671e

Please sign in to comment.