File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import { themeLight } from './styles/themes/theme.light';
1212import { themeDark } from './styles/themes/theme.dark' ;
1313import Game from './pages/Game' ;
1414import About from './pages/About' ;
15+ import Patterns from './pages/Patterns' ;
1516import { getMode } from './selectors' ;
1617
1718const Layout = props => {
@@ -32,6 +33,7 @@ const Layout = props => {
3233 < Header />
3334
3435 < Route exact path = "/" render = { ( ) => < Game style = { style } /> } />
36+ < Route path = "/patterns/:pattern" component = { Patterns } />
3537 < Route path = "/about" component = { About } />
3638 </ React . Fragment >
3739 </ ThemeProvider >
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ const Header = () => (
4646 < StyledHeader >
4747 < StyledLinkContainer >
4848 < StyledRouterLink to = "/" > Game</ StyledRouterLink >
49+ < StyledRouterLink to = "/patterns/memento" > Patterns</ StyledRouterLink >
4950 < StyledRouterLink to = "/about" > About</ StyledRouterLink >
5051 < StyledLink href = "//github.com/zoltantothcom/javascript-patterns" target = "_blank" >
5152 GitHub
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import PropTypes from 'prop-types' ;
3+ import styled from 'styled-components' ;
4+
5+ const StyledPatterns = styled . div `` ;
6+
7+ const Header = styled . h3 `
8+ color: ${ props => props . theme . buttonColorHover } ;
9+ margin-top: 2rem;
10+ ` ;
11+
12+ // const Patterns = ({ match }) => {
13+ // const { pattern } = match.params;
14+
15+ const Patterns = props => {
16+ console . log ( props ) ;
17+
18+ props . history . listen ( location => {
19+ console . log ( location ) ;
20+ } ) ;
21+
22+ const { pattern } = props . match . params ;
23+
24+ return (
25+ < StyledPatterns >
26+ < Header > { pattern } </ Header >
27+ </ StyledPatterns >
28+ ) ;
29+ } ;
30+
31+ Patterns . propTypes = {
32+ history : PropTypes . object . isRequired ,
33+ match : PropTypes . object . isRequired
34+ } ;
35+
36+ export default Patterns ;
You can’t perform that action at this time.
0 commit comments