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` const Tab = styled.div`
background: ${({ active }) => active ? 'blue' : 'white'}; background: ${({ active, theme }) => active ? theme.primary : 'white'};
color: ${({ active }) => active ? 'white' : 'blue'}; color: ${({ active, theme }) => active ? 'white' : theme.primary};
font-size: 18px; font-size: 18px;
padding: 5px; padding: 5px;
border: 2px solid blue; border: 2px solid ${({ theme }) => theme.primary};
border-left: none; border-left: none;
&:hover { &:hover {
cursor: pointer; cursor: pointer;
background: blue; background: ${({ theme }) => theme.primary};
color: white; color: white;
} }
&:first-child { &: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 React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import './index.css'; import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker'; 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(); serviceWorker.unregister();

View File

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