Merge pull request #10 from RandellDawson/feature/styled-components-theme

Implemented styled-components theme.
This commit is contained in:
Randell Dawson
2018-11-27 18:07:12 -08:00
committed by mrugesh mohapatra
parent 9332d4eb14
commit 091458c11c
3 changed files with 20 additions and 10 deletions

View File

@ -8,21 +8,21 @@ const Container = styled.div`
`;
const Tab = styled.div`
background: ${({ active }) => active ? 'blue' : 'white'};
color: ${({ active }) => active ? 'white' : 'blue'};
background: ${({ active, theme }) => active ? theme.primary : 'white'};
color: ${({ active, theme }) => active ? 'white' : theme.primary};
font-size: 18px;
padding: 5px;
border: 2px solid blue;
border: 2px solid ${({ theme }) => theme.primary};
border-left: none;
&:hover {
cursor: pointer;
background: blue;
background: ${({ theme }) => theme.primary};
color: white;
}
&:first-child {
border-left: 2px solid blue;
border-left: 2px solid ${({ theme }) => theme.primary};
}
`;

View File

@ -1,12 +1,17 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
import theme from './theme';
ReactDOM.render(<App />, document.getElementById('root'));
import App from './App';
import { ThemeProvider } from 'styled-components';
ReactDOM.render(
<ThemeProvider theme={theme}>
<App />
</ThemeProvider>,
document.getElementById('root'));
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: http://bit.ly/CRA-PWA
serviceWorker.unregister();

View File

@ -0,0 +1,5 @@
const theme = {
primary: 'blue'
};
export default theme;