From 19cba81fff2d2f1aa366f0b1244bdfee28107133 Mon Sep 17 00:00:00 2001 From: Al Duncanson Date: Tue, 11 Dec 2018 10:20:18 -0500 Subject: [PATCH] implemented react router --- src/components/Main.js | 172 ++++++++++++++++++++++++----------------- src/css/App.css | 4 + src/css/index.css | 0 src/index.js | 1 - 4 files changed, 103 insertions(+), 74 deletions(-) delete mode 100644 src/css/index.css diff --git a/src/components/Main.js b/src/components/Main.js index 94e145c..ac08619 100644 --- a/src/components/Main.js +++ b/src/components/Main.js @@ -34,8 +34,14 @@ import ExpandMore from '@material-ui/icons/ExpandMore'; import Collapse from '@material-ui/core/Collapse'; import FlameLinkCollectionGallery from '../components/flamelink/FlameLinkCollectionGallery'; import { MuiThemeProvider, createMuiTheme } from '@material-ui/core/styles'; -import Switch from '@material-ui/core/Switch'; +import ThemeSwitch from '@material-ui/core/Switch'; import { withCookies, Cookies } from 'react-cookie'; +import { + BrowserRouter as Router, + Route, + Link, + Switch +} from 'react-router-dom'; const drawerWidth = 240; @@ -121,7 +127,6 @@ class ResponsiveDrawer extends React.Component { this.setState({ mobileOpen: false, - key: 'Home', open: false, open2: false, theme: newTheme, @@ -142,17 +147,9 @@ class ResponsiveDrawer extends React.Component { this.setState(state => ({ open2: !state.open2, open: false })); } - nav = (text) => { - this.setState({ - key: text - }); - } - handleChange = name => event => { const { cookies } = this.props; - this.setState({ [name]: event.target.checked }); - var newTheme, newName; if (this.state.themeName === 'light') { @@ -189,28 +186,35 @@ class ResponsiveDrawer extends React.Component { render() { const { classes } = this.props; - const drawer = (
- this.nav('Home')}> - - - - this.nav('Report')}> - - - - this.nav('Map')}> - - - - this.nav('List')}> - - - + + + + + + + + + + + + + + + + + + + + + + + + @@ -218,27 +222,37 @@ class ResponsiveDrawer extends React.Component { {this.state.open ? : } - + - this.nav('Easy-Quiz')}> - - - this.nav('Intermediate-Quiz')}> - - - this.nav('Advanced-Quiz')}> - - + + + + + + + + + + + + + + + - this.nav('Contact')}> - - - - this.nav('About')}> - - - + + + + + + + + + + + + @@ -246,20 +260,28 @@ class ResponsiveDrawer extends React.Component { {this.state.open2 ? : } - + - this.nav('Gallery1')}> - - - this.nav('Gallery2')}> - - - this.nav('Gallery3')}> - - - this.nav('Gallery4')}> - - + + + + + + + + + + + + + + + + + + + + @@ -268,6 +290,7 @@ class ResponsiveDrawer extends React.Component { ); return ( +
@@ -279,12 +302,12 @@ class ResponsiveDrawer extends React.Component { onClick={this.handleDrawerToggle} className={classes.menuButton} > - + Marten Tracker -
- {this.state.key === 'Home' && } - {this.state.key === 'Report' && } - {this.state.key === 'Map' && } - {this.state.key === 'List' && } - {this.state.key === 'About' && } - {this.state.key === 'Contact' && } - {this.state.key === 'Easy-Quiz' && } - {this.state.key === 'Intermediate-Quiz' && } - {this.state.key === 'Advanced-Quiz' && } - {this.state.key === 'Gallery1' && } - {this.state.key === 'Gallery2' && } - {this.state.key === 'Gallery3' && } - {this.state.key === 'Gallery4' && } + + + { return }} /> + { return }} /> + { return }} /> + { return }} /> + { return }} /> + { return }} /> + { return }} /> + { return }} /> + { return }} /> + { return }} /> + { return }} /> + { return }} /> +
+
); } } diff --git a/src/css/App.css b/src/css/App.css index 6a79e73..d5aaa08 100644 --- a/src/css/App.css +++ b/src/css/App.css @@ -2,6 +2,10 @@ body { margin: 0; } +a { + text-decoration: none; +} + @media (min-width: 600px) { .sighting-google-map-container > div { width: calc(100% - 240px) !important; diff --git a/src/css/index.css b/src/css/index.css deleted file mode 100644 index e69de29..0000000 diff --git a/src/index.js b/src/index.js index c7183e0..35e39b3 100644 --- a/src/index.js +++ b/src/index.js @@ -1,6 +1,5 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import './css/index.css'; import App from './App.js'; import registerServiceWorker from './registerServiceWorker';