Skip to content

Commit bd2d77f

Browse files
committed
改善:PlanetNavigatorに活性化されているLinkを目立つようにする
1 parent 43403f8 commit bd2d77f

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

browser/main/Components/PlanetNavigator.jsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ var PlanetNavigator = React.createClass({
66
name: React.PropTypes.string,
77
Users: React.PropTypes.array
88
}),
9+
search: React.PropTypes.string,
910
openLaunchModal: React.PropTypes.func,
1011
openAddUserModal: React.PropTypes.func,
1112
showAll: React.PropTypes.func,
@@ -30,19 +31,29 @@ var PlanetNavigator = React.createClass({
3031
)
3132
})
3233

34+
var keywords = this.props.search.split(' ')
35+
var usingSnippetFilter = keywords.some(function (keyword) {
36+
if (keyword === '$s') return true
37+
return false
38+
})
39+
var usingBlueprintFilter = keywords.some(function (keyword) {
40+
if (keyword === '$b') return true
41+
return false
42+
})
43+
3344
return (
3445
<div className='PlanetNavigator'>
3546
<button onClick={this.props.openLaunchModal} className='launchButton btn-primary btn-block'>
3647
<i className='fa fa-rocket fa-fw'/> Launch
3748
</button>
3849
<nav>
39-
<a onClick={this.props.showAll}>
50+
<a className={usingSnippetFilter === usingBlueprintFilter ? 'active' : ''} onClick={this.props.showAll}>
4051
<i className='fa fa-home fa-fw'/> Home
4152
</a>
42-
<a onClick={this.props.showOnlySnippets}>
53+
<a className={usingSnippetFilter && !usingBlueprintFilter ? 'active' : ''} onClick={this.props.showOnlySnippets}>
4354
<i className='fa fa-code fa-fw'/> Snippets
4455
</a>
45-
<a onClick={this.props.showOnlyBlueprints}>
56+
<a className={!usingSnippetFilter && usingBlueprintFilter ? 'active' : ''} onClick={this.props.showOnlyBlueprints}>
4657
<i className='fa fa-file-text-o fa-fw'/> Blueprints
4758
</a>
4859
</nav>

browser/main/Containers/PlanetContainer.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,7 @@ module.exports = React.createClass({
558558
openSettingModal={this.openSettingModal} onSearchChange={this.handleSearchChange} currentPlanet={this.state.currentPlanet}/>
559559

560560
<PlanetNavigator openLaunchModal={this.openLaunchModal} openAddUserModal={this.openAddUserModal}
561+
search={this.state.search}
561562
showAll={this.showAll}
562563
showOnlySnippets={this.showOnlySnippets} showOnlyBlueprints={this.showOnlyBlueprints} currentPlanet={this.state.currentPlanet}/>
563564

0 commit comments

Comments
 (0)