Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion browser/components/NoteItemSimple.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import styles from './NoteItemSimple.styl'
* @param {Function} handleNoteContextMenu
* @param {Function} handleDragStart
*/
const NoteItemSimple = ({ isActive, note, handleNoteClick, handleNoteContextMenu, handleDragStart }) => (
const NoteItemSimple = ({ isActive, note, handleNoteClick, handleNoteContextMenu, handleDragStart, pathname }) => (
<div styleName={isActive
? 'item-simple--active'
: 'item-simple'
Expand All @@ -30,6 +30,10 @@ const NoteItemSimple = ({ isActive, note, handleNoteClick, handleNoteContextMenu
? <i styleName='item-simple-title-icon' className='fa fa-fw fa-code' />
: <i styleName='item-simple-title-icon' className='fa fa-fw fa-file-text-o' />
}
{note.isPinned && !pathname.match(/\/home|\/starred|\/trash/)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

writing logic on stateless component does not make sense because testing component will be harder.
plz receive boolean of which means same as !pathname.match(/\/home|\/starred|\/trash/

? <i styleName='item-pin' className='fa fa-thumb-tack' />
: ''
}
{note.title.trim().length > 0
? note.title
: <span styleName='item-simple-title-empty'>Empty</span>
Expand Down
10 changes: 10 additions & 0 deletions browser/components/NoteItemSimple.styl
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ $control-height = 30px
.item-simple-title
font-size 13px
height 40px
padding-right 20px
box-sizing border-box
line-height 24px
padding-top 8px
Expand All @@ -67,6 +68,15 @@ $control-height = 30px
font-weight normal
color $ui-inactive-text-color

.item-pin
position absolute
right 0px
top 12px
color #E54D42
font-size 14px
padding 0
border-radius 17px

body[data-theme="white"]
.item-simple
background-color $ui-white-noteList-backgroundColor
Expand Down
1 change: 1 addition & 0 deletions browser/main/NoteList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,7 @@ class NoteList extends React.Component {
handleNoteContextMenu={this.handleNoteContextMenu.bind(this)}
handleNoteClick={this.handleNoteClick.bind(this)}
handleDragStart={this.handleDragStart.bind(this)}
pathname={location.pathname}
/>
)
})
Expand Down