1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 17:56:25 +00:00

selected snippet item background-color is darken

This commit is contained in:
Sosuke Suzuki
2018-06-27 16:27:55 +09:00
parent c42b5c8806
commit 7414d52dc2
3 changed files with 25 additions and 2 deletions

View File

@@ -58,6 +58,16 @@ class SnippetList extends React.Component {
}).catch(err => { throw err }) }).catch(err => { throw err })
} }
defineSnippetStyleName (snippet) {
const { currentSnippet } = this.props
if (currentSnippet == null) return
if (currentSnippet.id === snippet.id) {
return 'snippet-item-selected'
} else {
return 'snippet-item'
}
}
render () { render () {
const { snippets } = this.state const { snippets } = this.state
return ( return (
@@ -73,7 +83,7 @@ class SnippetList extends React.Component {
{ {
snippets.map((snippet) => ( snippets.map((snippet) => (
<li <li
styleName='snippet-item' styleName={this.defineSnippetStyleName(snippet)}
key={snippet.id} key={snippet.id}
onContextMenu={() => this.handleSnippetContextMenu(snippet)} onContextMenu={() => this.handleSnippetContextMenu(snippet)}
onClick={() => this.handleSnippetClick(snippet)}> onClick={() => this.handleSnippetClick(snippet)}>

View File

@@ -67,7 +67,8 @@ class SnippetTab extends React.Component {
<div styleName='header'>{i18n.__('Snippets')}</div> <div styleName='header'>{i18n.__('Snippets')}</div>
<SnippetList <SnippetList
onSnippetSelect={this.handleSnippetSelect.bind(this)} onSnippetSelect={this.handleSnippetSelect.bind(this)}
onSnippetDeleted={this.handleDeleteSnippet.bind(this)} /> onSnippetDeleted={this.handleDeleteSnippet.bind(this)}
currentSnippet={currentSnippet} />
<div styleName='snippet-detail' style={{visibility: currentSnippet ? 'visible' : 'hidden'}}> <div styleName='snippet-detail' style={{visibility: currentSnippet ? 'visible' : 'hidden'}}>
<div styleName='group-section'> <div styleName='group-section'>
<div styleName='group-section-label'>{i18n.__('Snippet name')}</div> <div styleName='group-section-label'>{i18n.__('Snippet name')}</div>

View File

@@ -122,6 +122,10 @@
&:hover &:hover
background darken(#f5f5f5, 5) background darken(#f5f5f5, 5)
.snippet-item-selected
@extend .snippet-list .snippet-item
background darken(#f5f5f5, 5)
.snippet-detail .snippet-detail
width 70% width 70%
height calc(100% - 200px) height calc(100% - 200px)
@@ -142,6 +146,8 @@ body[data-theme="default"], body[data-theme="white"]
background $ui-borderColor background $ui-borderColor
&:hover &:hover
background darken($ui-backgroundColor, 5) background darken($ui-backgroundColor, 5)
.snippet-item-selected
background darken($ui-backgroundColor, 5)
body[data-theme="dark"] body[data-theme="dark"]
.snippets .snippets
@@ -152,6 +158,8 @@ body[data-theme="dark"]
background $ui-dark-borderColor background $ui-dark-borderColor
&:hover &:hover
background darken($ui-dark-backgroundColor, 5) background darken($ui-dark-backgroundColor, 5)
.snippet-item-selected
background darken($ui-dark-backgroundColor, 5)
.snippet-detail .snippet-detail
color white color white
.group-control-button .group-control-button
@@ -166,6 +174,8 @@ body[data-theme="solarized-dark"]
background $ui-solarized-dark-borderColor background $ui-solarized-dark-borderColor
&:hover &:hover
background darken($ui-solarized-dark-backgroundColor, 5) background darken($ui-solarized-dark-backgroundColor, 5)
.snippet-item-selected
background darken($ui-solarized-dark-backgroundColor, 5)
.snippet-detail .snippet-detail
color white color white
.group-control-button .group-control-button
@@ -180,6 +190,8 @@ body[data-theme="monokai"]
background $ui-monokai-borderColor background $ui-monokai-borderColor
&:hover &:hover
background darken($ui-monokai-backgroundColor, 5) background darken($ui-monokai-backgroundColor, 5)
.snippet-item-selected
background darken($ui-monokai-backgroundColor, 5)
.snippet-detail .snippet-detail
color white color white
.group-control-button .group-control-button