From 2274155801281a7e1f74a26f07572dbc7ead7fea Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Tue, 2 Aug 2016 09:36:48 +0800 Subject: [PATCH] split out a separate MapLink component for code reuse --- frontend/src/components/Header.js | 78 ++++++++++++++++++++----------- 1 file changed, 52 insertions(+), 26 deletions(-) diff --git a/frontend/src/components/Header.js b/frontend/src/components/Header.js index 1764d74a..f8f2f485 100644 --- a/frontend/src/components/Header.js +++ b/frontend/src/components/Header.js @@ -1,5 +1,19 @@ import React, { Component, PropTypes } from 'react' +const MapLink = props => { + const { show, linkText, href, linkClass, ...otherProps } = props + if (!show) { + return null + } + + return ( + +
+ {linkText} +
+ ) +} + class Header extends Component { render = () => { const { signedIn, section } = this.props @@ -20,35 +34,47 @@ class Header extends Component {
- {signedIn && explore ? -
- My Maps -
: null } - {signedIn && explore ? -
- Shared With Me -
: null } - {explore ? -
- Recently Active -
: null } - {!signedIn && explore ? -
- Featured Maps -
: null } - {mapper ?
+ + + + + + {mapper ? ( +
{this.props.userName}’s Maps
-
: null } - {apps ? -
- Registered Apps -
: null } - {apps ? -
- Authorized Apps -
: null } +
+ ) : null } + + +