1
0
mirror of https://github.com/BoostIo/Boostnote synced 2026-01-02 03:29:20 +00:00

Merge pull request #1049 from mslourens/selected-tag-issue

only make the selected tag active
This commit is contained in:
Kazu Yokomizo
2017-11-05 11:39:42 +09:00
committed by GitHub

View File

@@ -104,13 +104,19 @@ class SideNav extends React.Component {
<TagListItem
name={tag}
handleClickTagListItem={this.handleClickTagListItem.bind(this)}
isActive={!!location.pathname.match(tag)}
isActive={this.getTagActive(location.pathname, tag)}
key={tag}
/>
))
)
}
getTagActive (path, tag) {
const pathSegments = path.split('/')
const pathTag = pathSegments[pathSegments.length - 1]
return pathTag === tag
}
handleClickTagListItem (name) {
const { router } = this.context
router.push(`/tags/${name}`)