-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Footer and app container now support theme
- Loading branch information
Showing
9 changed files
with
253 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
|
||
|
||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.