Skip to content

Commit 820a2a0

Browse files
authored
Merge pull request #1275 from BoostIO/add-pin-note-item-simple
Add Pin to NoteItemSimple
2 parents d3995b9 + eececf8 commit 820a2a0

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

browser/components/NoteItemSimple.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import styles from './NoteItemSimple.styl'
1414
* @param {Function} handleNoteContextMenu
1515
* @param {Function} handleDragStart
1616
*/
17-
const NoteItemSimple = ({ isActive, note, handleNoteClick, handleNoteContextMenu, handleDragStart }) => (
17+
const NoteItemSimple = ({ isActive, note, handleNoteClick, handleNoteContextMenu, handleDragStart, pathname }) => (
1818
<div styleName={isActive
1919
? 'item-simple--active'
2020
: 'item-simple'
@@ -30,6 +30,10 @@ const NoteItemSimple = ({ isActive, note, handleNoteClick, handleNoteContextMenu
3030
? <i styleName='item-simple-title-icon' className='fa fa-fw fa-code' />
3131
: <i styleName='item-simple-title-icon' className='fa fa-fw fa-file-text-o' />
3232
}
33+
{note.isPinned && !pathname.match(/\/home|\/starred|\/trash/)
34+
? <i styleName='item-pin' className='fa fa-thumb-tack' />
35+
: ''
36+
}
3337
{note.title.trim().length > 0
3438
? note.title
3539
: <span styleName='item-simple-title-empty'>Empty</span>

browser/components/NoteItemSimple.styl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ $control-height = 30px
5050
.item-simple-title
5151
font-size 13px
5252
height 40px
53+
padding-right 20px
5354
box-sizing border-box
5455
line-height 24px
5556
padding-top 8px
@@ -67,6 +68,15 @@ $control-height = 30px
6768
font-weight normal
6869
color $ui-inactive-text-color
6970

71+
.item-pin
72+
position absolute
73+
right 0px
74+
top 12px
75+
color #E54D42
76+
font-size 14px
77+
padding 0
78+
border-radius 17px
79+
7080
body[data-theme="white"]
7181
.item-simple
7282
background-color $ui-white-noteList-backgroundColor

browser/main/NoteList/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,7 @@ class NoteList extends React.Component {
717717
handleNoteContextMenu={this.handleNoteContextMenu.bind(this)}
718718
handleNoteClick={this.handleNoteClick.bind(this)}
719719
handleDragStart={this.handleDragStart.bind(this)}
720+
pathname={location.pathname}
720721
/>
721722
)
722723
})

0 commit comments

Comments
 (0)