Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
59 lines (53 sloc) 2.13 KB
// Copyright 2019 Stanford University see LICENSE for license
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { NavLink } from 'react-router-dom'
import Config from 'Config'
import { connect } from 'react-redux'
import _ from 'lodash'
class Header extends Component {
render() {
return (
<div className="navbar editor-navbar">
<div>
<ul className="nav navbar-nav pull-right">
<li>
<a className="editor-header-text" href={`https://profile-editor.${Config.sinopiaDomainName}/`}>Profile Editor</a>
</li>
<li className="menu">
<a href="#" className="editor-help-resources" onClick={this.props.triggerEditorMenu}>Help and Resources</a>
</li>
</ul>
<div>
<h2 className="editor-subtitle"><a className="editor-subtitle" href="/">SINOPIA</a></h2> <h2 className="editor-version">v{this.props.version}</h2>
<h1 className="editor-logo">LINKED DATA EDITOR</h1>
</div>
<div>
<ul className="nav nav-tabs pull-left editor-navtabs">
{ /* Navlinks enable highlighting the appropriate tab based on route, active style is defined in css */}
<li className="nav-item"><NavLink className="nav-link" to="/search">Search</NavLink></li>
<li className="nav-item"><NavLink className="nav-link" to="/templates">Resource Templates</NavLink></li>
<li className="nav-item"><NavLink className="nav-link" to="/load">Load RDF</NavLink></li>
{ this.props.hasResource
&& <li className="nav-item"><NavLink className="nav-link" to="/editor">Editor</NavLink></li>
}
</ul>
</div>
</div>
</div>
)
}
}
Header.propTypes = {
triggerEditorMenu: PropTypes.func,
version: PropTypes.string,
hasResource: PropTypes.bool,
}
const mapStateToProps = (state) => {
const hasResource = !_.isEmpty(state.selectorReducer.resource)
return {
version: state.selectorReducer.appVersion.version,
hasResource,
}
}
export default connect(mapStateToProps)(Header)
You can’t perform that action at this time.