Skip to content

Commit

Permalink
Lesson 05 complete. Lesson 06 - adding some styled components and add…
Browse files Browse the repository at this point in the history
…ing a theme to Pages.js. Using ThemeProvider (which uses COntext) to pass values down to great grandchildren without having to prop drill.
  • Loading branch information
phillystafford committed Jun 3, 2019
1 parent 5cf0377 commit 9440485
Showing 1 changed file with 29 additions and 5 deletions.
34 changes: 29 additions & 5 deletions sick-fits/frontend/components/Page.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,39 @@
import React, { Component } from 'react';
import Header from './Header';
import Meta from './Meta';
import styled, { ThemeProvider } from 'styled-components';

const theme = {
red: '#FF0000',
black: '#393939',
grey: '#3A3A3A',
lightgrey: '#E1E1E1',
offWhite: '#EDEDED',
maxWidth: '1000px',
bs: '0 12px 24px 0 rgba(0, 0, 0, 0.09)'
};

const StyledPage = styled.div`
background: white;
color: ${props => props.theme.black};
`;

const Inner = styled.div`
max-width: ${props => props.theme.maxWidth};
margin: 0 auto;
padding: 2rem;
`;

class Page extends Component {
render() {
return (
<div>
<Meta />
<Header />
{this.props.children}
</div>
<ThemeProvider theme={theme}>
<StyledPage>
<Meta />
<Header />
<Inner>{this.props.children}</Inner>
</StyledPage>
</ThemeProvider>
);
}
}
Expand Down

0 comments on commit 9440485

Please sign in to comment.