Skip to content

Commit c7ad06a

Browse files
committed
Update NoteList
redirect if no note selected add overflow style of labels in Note item
1 parent d07c795 commit c7ad06a

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

browser/main/NoteList/NoteList.styl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
cursor pointer
1414
transition background-color 0.15s
1515
&:hover
16-
background-color alpha(black, 5%)
16+
background-color alpha($ui-active-color, 10%)
1717

1818
.item--active
1919
@extend .item
@@ -33,9 +33,11 @@
3333
font-size 12px
3434
color $ui-inactive-text-color
3535
line-height 30px
36+
overflow-y hidden
3637

3738
.item-info-left
3839
float left
40+
overflow ellipsis
3941

4042
.item-info-right
4143
float right
@@ -52,3 +54,4 @@
5254
font-size 12px
5355
line-height 30px
5456
color $ui-inactive-text-color
57+
overflow ellipsis

browser/main/NoteList/index.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ class NoteList extends React.Component {
2929
}
3030

3131
componentDidUpdate () {
32+
let { location } = this.props
33+
if (this.notes.length > 0 && location.query.key == null) {
34+
let { router } = this.context
35+
router.replace({
36+
pathname: location.pathname,
37+
query: {
38+
key: `${this.notes[0]._repository.key}-${this.notes[0].key}`
39+
}
40+
})
41+
}
3242
// return false
3343
// var index = articles.indexOf(null)
3444
// var el = ReactDOM.findDOMNode(this)
@@ -175,13 +185,13 @@ class NoteList extends React.Component {
175185

176186
render () {
177187
let { location } = this.props
178-
let notes = this.getNotes()
188+
let notes = this.notes = this.getNotes()
179189
let noteElements = notes.map((note) => {
180190
let folder = _.find(note._repository.folders, {key: note.folder})
181191
let tagElements = note.tags.map((tag) => {
182192
return <span key='tag'>{tag}</span>
183193
})
184-
let key = `${note._repository.key}/${note.key}`
194+
let key = `${note._repository.key}-${note.key}`
185195
let isActive = location.query.key === key
186196
return (
187197
<div styleName={isActive

0 commit comments

Comments
 (0)