Skip to content

Commit

Permalink
Show general menus if it's in landing page
Browse files Browse the repository at this point in the history
  • Loading branch information
nujabes403 committed Nov 7, 2019
1 parent a7602e5 commit c7496e9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 0 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import Mainpage from 'pages/Mainpage'

import Header from 'components/Header'
import SectionDescription from 'components/SectionDescription'
import Menu from 'components/Menu'
import MobileMenu from 'components/MobileMenu'
import Modal from 'components/Modal'

import './App.scss'
Expand Down
8 changes: 6 additions & 2 deletions src/components/Sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class Sidebar extends Component<Props> {
render() {
const { query, pathname } = browserHistory.getCurrentLocation()

const isLandingPage = query && !query.l

const selectedItem = {
link: pathname,
pathnameOnly: String(pathname).split('?')[0],
Expand All @@ -33,15 +35,17 @@ class Sidebar extends Component<Props> {
<div className="Sidebar">
<div
className={cx('Sidebar__label', {
'Sidebar__label--selected': query && !query.l,
'Sidebar__label--selected': isLandingPage,
})}
onClick={() => browserHistory.push('/')}
>
Welcome
</div>
{menuItems && Object.entries(menuItems).map(([bookLabel, items]) => {

const isBookLabelSelected = selectedItem.label && (selectedItem.label === bookLabel)
const isBookLabelSelected = isLandingPage
? bookLabel === 'GENERAL' // Show GENERAL menus if it's in landing page.
: selectedItem.label && (selectedItem.label === bookLabel)

return (
<Fragment>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
@include shrink-active;

font-weight: bold;
margin-bottom: 0;
margin-bottom: 4px;
height: 42px;
line-height: 42px;
padding-left: 16px;
Expand Down

0 comments on commit c7496e9

Please sign in to comment.