From 39c8c54c3a62ba426b7044142b1fe22004ed7796 Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Fri, 10 Feb 2023 11:42:34 -0800 Subject: [PATCH] more refactoring to reduce props --- src/App.js | 10 ++---- src/components/nav-menu/old-index.js | 52 ++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 7 deletions(-) create mode 100644 src/components/nav-menu/old-index.js diff --git a/src/App.js b/src/App.js index 4a73b2b..ea6a2a6 100644 --- a/src/App.js +++ b/src/App.js @@ -141,16 +141,12 @@ function App (props) { return ( <> - + { showStartModal - ? () - : () + ? () + : () } diff --git a/src/components/nav-menu/old-index.js b/src/components/nav-menu/old-index.js new file mode 100644 index 0000000..84647e8 --- /dev/null +++ b/src/components/nav-menu/old-index.js @@ -0,0 +1,52 @@ +/* + This component controlls the navigation menu. + + Inspired from this example: + https://codesandbox.io/s/react-bootstrap-hamburger-menu-example-rnud4?from-embed +*/ + +// Global npm libraries +import React from 'react' +import { Nav, Navbar, Image } from 'react-bootstrap' +import Logo from './psf-logo.png' + +class NavMenu extends React.Component { + constructor (props) { + super(props) + + // This is the event handler passed in from the Parent component. + this.parentMenuHandler = props.menuHandler + } + + render () { + // console.log(`selectedMenuItem: ${this.state.selectedMenuItem}`) + // this.handleMenuClick(this.state.selectedMenuItem) + + return ( + <> + + + {' '} + PSF Web3 Demo + + + + + + + + + ) + } + + handleClickEvent (menuItem) { + // Pass the selected menu item up to the parent component. + this.parentMenuHandler(menuItem) + } +} + +export default NavMenu