1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 09:46:22 +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 })
}
defineSnippetStyleName (snippet) {
const { currentSnippet } = this.props
if (currentSnippet == null) return
if (currentSnippet.id === snippet.id) {
return 'snippet-item-selected'
} else {
return 'snippet-item'
}
}
render () {
const { snippets } = this.state
return (
@@ -73,7 +83,7 @@ class SnippetList extends React.Component {
{
snippets.map((snippet) => (
<li
styleName='snippet-item'
styleName={this.defineSnippetStyleName(snippet)}
key={snippet.id}
onContextMenu={() => this.handleSnippetContextMenu(snippet)}
onClick={() => this.handleSnippetClick(snippet)}>