mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-17 03:31:52 +00:00
Fix: PlanetNavigatorのHome削除 & SnippetsとBlueprintsはToggleができるように
This commit is contained in:
@@ -13,9 +13,8 @@ var PlanetNavigator = React.createClass({
|
|||||||
search: React.PropTypes.string,
|
search: React.PropTypes.string,
|
||||||
openLaunchModal: React.PropTypes.func,
|
openLaunchModal: React.PropTypes.func,
|
||||||
openAddUserModal: React.PropTypes.func,
|
openAddUserModal: React.PropTypes.func,
|
||||||
showAll: React.PropTypes.func,
|
toggleSnippetFilter: React.PropTypes.func,
|
||||||
showOnlySnippets: React.PropTypes.func,
|
toggleBlueprintFilter: React.PropTypes.func
|
||||||
showOnlyBlueprints: React.PropTypes.func
|
|
||||||
},
|
},
|
||||||
getInitialState: function () {
|
getInitialState: function () {
|
||||||
return {
|
return {
|
||||||
@@ -53,13 +52,10 @@ var PlanetNavigator = React.createClass({
|
|||||||
<i className='fa fa-rocket fa-fw'/> Launch
|
<i className='fa fa-rocket fa-fw'/> Launch
|
||||||
</button>
|
</button>
|
||||||
<nav>
|
<nav>
|
||||||
<a className={usingSnippetFilter === usingBlueprintFilter ? 'active' : ''} onClick={this.props.showAll}>
|
<a className={usingSnippetFilter && !usingBlueprintFilter ? 'active' : ''} onClick={this.props.toggleSnippetFilter}>
|
||||||
<i className='fa fa-home fa-fw'/> Home
|
|
||||||
</a>
|
|
||||||
<a className={usingSnippetFilter && !usingBlueprintFilter ? 'active' : ''} onClick={this.props.showOnlySnippets}>
|
|
||||||
<i className='fa fa-code fa-fw'/> Snippets
|
<i className='fa fa-code fa-fw'/> Snippets
|
||||||
</a>
|
</a>
|
||||||
<a className={!usingSnippetFilter && usingBlueprintFilter ? 'active' : ''} onClick={this.props.showOnlyBlueprints}>
|
<a className={!usingSnippetFilter && usingBlueprintFilter ? 'active' : ''} onClick={this.props.toggleBlueprintFilter}>
|
||||||
<i className='fa fa-file-text-o fa-fw'/> Blueprints
|
<i className='fa fa-file-text-o fa-fw'/> Blueprints
|
||||||
</a>
|
</a>
|
||||||
</nav>
|
</nav>
|
||||||
|
|||||||
@@ -339,11 +339,57 @@ module.exports = React.createClass({
|
|||||||
showAll: function () {
|
showAll: function () {
|
||||||
this.setState({search: ''})
|
this.setState({search: ''})
|
||||||
},
|
},
|
||||||
showOnlySnippets: function () {
|
toggleSnippetFilter: function () {
|
||||||
this.setState({search: '$s'})
|
var keywords = typeof this.state.search === 'string' ? this.state.search.split(' ') : []
|
||||||
|
|
||||||
|
var usingSnippetFilter = false
|
||||||
|
var usingBlueprintFilter = false
|
||||||
|
keywords = keywords.filter(function (keyword) {
|
||||||
|
if (keyword === '$b') {
|
||||||
|
usingBlueprintFilter = true
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (keyword === '$s') usingSnippetFilter = true
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
|
||||||
|
if (usingSnippetFilter && !usingBlueprintFilter) {
|
||||||
|
keywords = keywords.filter(function (keyword) {
|
||||||
|
return keyword !== '$s'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!usingSnippetFilter) {
|
||||||
|
keywords.unshift('$s')
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState({search: keywords.join(' ')})
|
||||||
},
|
},
|
||||||
showOnlyBlueprints: function () {
|
toggleBlueprintFilter: function () {
|
||||||
this.setState({search: '$b'})
|
var keywords = typeof this.state.search === 'string' ? this.state.search.split(' ') : []
|
||||||
|
|
||||||
|
var usingSnippetFilter = false
|
||||||
|
var usingBlueprintFilter = false
|
||||||
|
keywords = keywords.filter(function (keyword) {
|
||||||
|
if (keyword === '$s') {
|
||||||
|
usingSnippetFilter = true
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (keyword === '$b') usingBlueprintFilter = true
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
|
||||||
|
if (usingBlueprintFilter && !usingSnippetFilter) {
|
||||||
|
keywords = keywords.filter(function (keyword) {
|
||||||
|
return keyword !== '$b'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!usingBlueprintFilter) {
|
||||||
|
keywords.unshift('$b')
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setState({search: keywords.join(' ')})
|
||||||
},
|
},
|
||||||
showOnlyWithTag: function (tag) {
|
showOnlyWithTag: function (tag) {
|
||||||
return function () {
|
return function () {
|
||||||
@@ -560,7 +606,7 @@ module.exports = React.createClass({
|
|||||||
<PlanetNavigator openLaunchModal={this.openLaunchModal} openAddUserModal={this.openAddUserModal}
|
<PlanetNavigator openLaunchModal={this.openLaunchModal} openAddUserModal={this.openAddUserModal}
|
||||||
search={this.state.search}
|
search={this.state.search}
|
||||||
showAll={this.showAll}
|
showAll={this.showAll}
|
||||||
showOnlySnippets={this.showOnlySnippets} showOnlyBlueprints={this.showOnlyBlueprints} currentPlanet={this.state.currentPlanet}/>
|
toggleSnippetFilter={this.toggleSnippetFilter} toggleBlueprintFilter={this.toggleBlueprintFilter} currentPlanet={this.state.currentPlanet}/>
|
||||||
|
|
||||||
<PlanetArticleList showOnlyWithTag={this.showOnlyWithTag} ref='list' articles={filteredArticles}/>
|
<PlanetArticleList showOnlyWithTag={this.showOnlyWithTag} ref='list' articles={filteredArticles}/>
|
||||||
|
|
||||||
|
|||||||
@@ -111,10 +111,8 @@
|
|||||||
color textColor
|
color textColor
|
||||||
cursor pointer
|
cursor pointer
|
||||||
transition 0.1s
|
transition 0.1s
|
||||||
&:hover, &.hover
|
btnDefault()
|
||||||
background-color hoverBackgroundColor
|
border none
|
||||||
&:active, &.active
|
|
||||||
color brandColor
|
|
||||||
.usersLabel
|
.usersLabel
|
||||||
margin-top 35px
|
margin-top 35px
|
||||||
margin-bottom 5px
|
margin-bottom 5px
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ buttonBorderColor = #4C4C4C
|
|||||||
|
|
||||||
lightButtonColor = #898989
|
lightButtonColor = #898989
|
||||||
|
|
||||||
hoverBackgroundColor= transparentify(#444, 3%)
|
hoverBackgroundColor= transparentify(#444, 10%)
|
||||||
|
activeBackgroundColor= transparentify(#888, 10%)
|
||||||
|
|
||||||
// v0.2.0
|
// v0.2.0
|
||||||
inactiveTextColor = #888
|
inactiveTextColor = #888
|
||||||
|
|||||||
Reference in New Issue
Block a user