1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 01:36:22 +00:00

Update NoteList

redirect if no note selected
add overflow style of labels in Note item
This commit is contained in:
Dick Choi
2016-05-25 02:16:22 +09:00
parent d07c795511
commit c7ad06a1f7
2 changed files with 16 additions and 3 deletions

View File

@@ -13,7 +13,7 @@
cursor pointer cursor pointer
transition background-color 0.15s transition background-color 0.15s
&:hover &:hover
background-color alpha(black, 5%) background-color alpha($ui-active-color, 10%)
.item--active .item--active
@extend .item @extend .item
@@ -33,9 +33,11 @@
font-size 12px font-size 12px
color $ui-inactive-text-color color $ui-inactive-text-color
line-height 30px line-height 30px
overflow-y hidden
.item-info-left .item-info-left
float left float left
overflow ellipsis
.item-info-right .item-info-right
float right float right
@@ -52,3 +54,4 @@
font-size 12px font-size 12px
line-height 30px line-height 30px
color $ui-inactive-text-color color $ui-inactive-text-color
overflow ellipsis

View File

@@ -29,6 +29,16 @@ class NoteList extends React.Component {
} }
componentDidUpdate () { componentDidUpdate () {
let { location } = this.props
if (this.notes.length > 0 && location.query.key == null) {
let { router } = this.context
router.replace({
pathname: location.pathname,
query: {
key: `${this.notes[0]._repository.key}-${this.notes[0].key}`
}
})
}
// return false // return false
// var index = articles.indexOf(null) // var index = articles.indexOf(null)
// var el = ReactDOM.findDOMNode(this) // var el = ReactDOM.findDOMNode(this)
@@ -175,13 +185,13 @@ class NoteList extends React.Component {
render () { render () {
let { location } = this.props let { location } = this.props
let notes = this.getNotes() let notes = this.notes = this.getNotes()
let noteElements = notes.map((note) => { let noteElements = notes.map((note) => {
let folder = _.find(note._repository.folders, {key: note.folder}) let folder = _.find(note._repository.folders, {key: note.folder})
let tagElements = note.tags.map((tag) => { let tagElements = note.tags.map((tag) => {
return <span key='tag'>{tag}</span> return <span key='tag'>{tag}</span>
}) })
let key = `${note._repository.key}/${note.key}` let key = `${note._repository.key}-${note.key}`
let isActive = location.query.key === key let isActive = location.query.key === key
return ( return (
<div styleName={isActive <div styleName={isActive