mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +00:00
modify: change design for note list on finder
This commit is contained in:
@@ -1,85 +0,0 @@
|
|||||||
import React, { PropTypes } from 'react'
|
|
||||||
import CSSModules from 'browser/lib/CSSModules'
|
|
||||||
import styles from './NoteItem.styl'
|
|
||||||
import moment from 'moment'
|
|
||||||
import _ from 'lodash'
|
|
||||||
|
|
||||||
class NoteItem extends React.Component {
|
|
||||||
constructor (props) {
|
|
||||||
super(props)
|
|
||||||
|
|
||||||
this.state = {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
handleClick (e) {
|
|
||||||
this.props.onClick(e)
|
|
||||||
}
|
|
||||||
|
|
||||||
render () {
|
|
||||||
let { note, folder, storage, isActive } = this.props
|
|
||||||
|
|
||||||
let tagList = _.isArray(note.tags)
|
|
||||||
? note.tags.map((tag) => {
|
|
||||||
return (
|
|
||||||
<span styleName='bottom-tagList-item'
|
|
||||||
key={tag}>
|
|
||||||
{tag}
|
|
||||||
</span>
|
|
||||||
)
|
|
||||||
})
|
|
||||||
: []
|
|
||||||
return (
|
|
||||||
<div styleName={isActive
|
|
||||||
? 'root--active'
|
|
||||||
: 'root'
|
|
||||||
}
|
|
||||||
key={note.storage + '-' + note.key}
|
|
||||||
onClick={(e) => this.handleClick(e)}
|
|
||||||
>
|
|
||||||
<div styleName='info'>
|
|
||||||
<div styleName='info-left'>
|
|
||||||
<span styleName='info-left-folder'
|
|
||||||
style={{borderColor: folder.color}}
|
|
||||||
>
|
|
||||||
{folder.name}
|
|
||||||
<span styleName='info-left-folder-surfix'>in {storage.name}</span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div styleName='title'>
|
|
||||||
{note.type === 'SNIPPET_NOTE'
|
|
||||||
? <i styleName='title-icon' className='fa fa-fw fa-code' />
|
|
||||||
: <i styleName='title-icon' className='fa fa-fw fa-file-text-o' />
|
|
||||||
}
|
|
||||||
{note.title.trim().length > 0
|
|
||||||
? note.title
|
|
||||||
: <span styleName='title-empty'>Empty</span>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div styleName='bottom'>
|
|
||||||
<i styleName='bottom-tagIcon'
|
|
||||||
className='fa fa-tags fa-fw'
|
|
||||||
/>
|
|
||||||
<div styleName='bottom-tagList'>
|
|
||||||
{tagList.length > 0
|
|
||||||
? tagList
|
|
||||||
: <span styleName='bottom-tagList-empty'>Not tagged yet</span>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div styleName='bottom-time'>
|
|
||||||
{moment(note.updatedAt).fromNow()}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NoteItem.propTypes = {
|
|
||||||
}
|
|
||||||
|
|
||||||
export default CSSModules(NoteItem, styles)
|
|
||||||
@@ -1,179 +0,0 @@
|
|||||||
.root
|
|
||||||
position relative
|
|
||||||
border-bottom $ui-border
|
|
||||||
padding 2px 5px
|
|
||||||
user-select none
|
|
||||||
cursor pointer
|
|
||||||
transition background-color 0.15s
|
|
||||||
&:hover
|
|
||||||
background-color alpha($ui-active-color, 20%)
|
|
||||||
|
|
||||||
.root--active
|
|
||||||
@extend .root
|
|
||||||
background-color $ui-active-color
|
|
||||||
&:hover
|
|
||||||
background-color $ui-active-color
|
|
||||||
color white
|
|
||||||
.info-left-folder
|
|
||||||
.info-left-folder-surfix
|
|
||||||
.title
|
|
||||||
.title-icon
|
|
||||||
.title-empty
|
|
||||||
.bottom-tagIcon
|
|
||||||
.bottom-tagList-item
|
|
||||||
.bottom-tagList-empty
|
|
||||||
.bottom-time
|
|
||||||
color white
|
|
||||||
.bottom-tagList-item
|
|
||||||
color white
|
|
||||||
background-color transparent
|
|
||||||
|
|
||||||
.border
|
|
||||||
absolute top bottom left right
|
|
||||||
border-style solid
|
|
||||||
border-width 2px
|
|
||||||
border-color transparent
|
|
||||||
transition 0.15s
|
|
||||||
|
|
||||||
.info
|
|
||||||
height 20px
|
|
||||||
clearfix()
|
|
||||||
font-size 12px
|
|
||||||
color $ui-inactive-text-color
|
|
||||||
line-height 20px
|
|
||||||
overflow-y hidden
|
|
||||||
|
|
||||||
.info-left
|
|
||||||
float left
|
|
||||||
overflow ellipsis
|
|
||||||
|
|
||||||
.info-left-folder
|
|
||||||
border-left 4px solid transparent
|
|
||||||
padding 2px 5px
|
|
||||||
color $ui-text-color
|
|
||||||
.info-left-folder-surfix
|
|
||||||
font-size 10px
|
|
||||||
margin-left 5px
|
|
||||||
color $ui-inactive-text-color
|
|
||||||
.info-right
|
|
||||||
float right
|
|
||||||
|
|
||||||
.title
|
|
||||||
height 24px
|
|
||||||
box-sizing border-box
|
|
||||||
line-height 24px
|
|
||||||
height 20px
|
|
||||||
line-height 20px
|
|
||||||
padding 0 5px 0 0
|
|
||||||
overflow ellipsis
|
|
||||||
color $ui-text-color
|
|
||||||
|
|
||||||
.title-icon
|
|
||||||
font-size 12px
|
|
||||||
color $ui-inactive-text-color
|
|
||||||
padding-right 3px
|
|
||||||
|
|
||||||
.title-empty
|
|
||||||
font-weight normal
|
|
||||||
color $ui-inactive-text-color
|
|
||||||
|
|
||||||
.bottom
|
|
||||||
margin-top 2px
|
|
||||||
height 20px
|
|
||||||
font-size 12px
|
|
||||||
line-height 20px
|
|
||||||
overflow ellipsis
|
|
||||||
display flex
|
|
||||||
|
|
||||||
.bottom-tagIcon
|
|
||||||
vertical-align middle
|
|
||||||
color $ui-button-color
|
|
||||||
height 20px
|
|
||||||
line-height 20px
|
|
||||||
|
|
||||||
.bottom-tagList
|
|
||||||
flex 1
|
|
||||||
overflow ellipsis
|
|
||||||
line-height 20px
|
|
||||||
|
|
||||||
.bottom-tagList-item
|
|
||||||
margin 0 4px
|
|
||||||
padding 0 4px
|
|
||||||
height 20px
|
|
||||||
box-sizing border-box
|
|
||||||
border-radius 3px
|
|
||||||
vertical-align middle
|
|
||||||
border-style solid
|
|
||||||
border-color $ui-button--focus-borderColor
|
|
||||||
border-width 0 0 0 3px
|
|
||||||
background-color $ui-backgroundColor
|
|
||||||
color $ui-text-color
|
|
||||||
transition 0.15s
|
|
||||||
|
|
||||||
.bottom-tagList-empty
|
|
||||||
color $ui-inactive-text-color
|
|
||||||
vertical-align middle
|
|
||||||
font-size 10px
|
|
||||||
margin-left 5px
|
|
||||||
|
|
||||||
.bottom-time
|
|
||||||
color $ui-inactive-text-color
|
|
||||||
margin-left 5px
|
|
||||||
font-size 10px
|
|
||||||
|
|
||||||
body[data-theme="dark"]
|
|
||||||
.root
|
|
||||||
border-color $ui-dark-borderColor
|
|
||||||
|
|
||||||
.root--active
|
|
||||||
@extend .root
|
|
||||||
border-color $ui-dark-borderColor
|
|
||||||
&:hover
|
|
||||||
background-color $ui-active-color
|
|
||||||
.info-left-folder
|
|
||||||
.info-left-folder-surfix
|
|
||||||
.title
|
|
||||||
.title-icon
|
|
||||||
.title-empty
|
|
||||||
.bottom-tagIcon
|
|
||||||
.bottom-tagList-item
|
|
||||||
.bottom-tagList-empty
|
|
||||||
.bottom-time
|
|
||||||
color white
|
|
||||||
.bottom-tagList-item
|
|
||||||
color white
|
|
||||||
background-color transparent
|
|
||||||
|
|
||||||
.info
|
|
||||||
color $ui-dark-inactive-text-color
|
|
||||||
|
|
||||||
.info-left-folder
|
|
||||||
color $ui-dark-text-color
|
|
||||||
|
|
||||||
.info-left-folder-surfix
|
|
||||||
color $ui-dark-inactive-text-color
|
|
||||||
|
|
||||||
.title
|
|
||||||
color $ui-dark-text-color
|
|
||||||
|
|
||||||
.title-icon
|
|
||||||
color $ui-dark-inactive-text-color
|
|
||||||
|
|
||||||
.title-empty
|
|
||||||
color $ui-dark-inactive-text-color
|
|
||||||
|
|
||||||
.tagList-empty
|
|
||||||
color $ui-dark-inactive-text-color
|
|
||||||
|
|
||||||
.bottom-tagIcon
|
|
||||||
color $ui-dark-button-color
|
|
||||||
|
|
||||||
.bottom-tagList-item
|
|
||||||
color $ui-dark-text-color
|
|
||||||
background-color $ui-dark-backgroundColor
|
|
||||||
|
|
||||||
.bottom-tagList-empty
|
|
||||||
color $ui-dark-inactive-text-color
|
|
||||||
|
|
||||||
.bottom-time
|
|
||||||
color $ui-dark-inactive-text-color
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import React, { PropTypes } from 'react'
|
import React, { PropTypes } from 'react'
|
||||||
import NoteItem from './NoteItem'
|
import NoteItem from 'browser/components/NoteItem'
|
||||||
import _ from 'lodash'
|
import moment from 'moment'
|
||||||
|
|
||||||
class NoteList extends React.Component {
|
class NoteList extends React.Component {
|
||||||
constructor (props) {
|
constructor (props) {
|
||||||
@@ -59,16 +59,19 @@ class NoteList extends React.Component {
|
|||||||
let notesList = notes
|
let notesList = notes
|
||||||
.slice(0, 10 + 10 * this.state.range)
|
.slice(0, 10 + 10 * this.state.range)
|
||||||
.map((note, _index) => {
|
.map((note, _index) => {
|
||||||
let storage = storageMap[note.storage]
|
|
||||||
let folder = _.find(storage.folders, {key: note.folder})
|
const isActive = (index === _index)
|
||||||
|
const key = `${note.storage}-${note.key}`
|
||||||
|
const dateDisplay = moment(note.updatedAt).fromNow()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NoteItem
|
<NoteItem
|
||||||
|
isActive={isActive}
|
||||||
note={note}
|
note={note}
|
||||||
key={`${note.storage}-${note.key}`}
|
dateDisplay={dateDisplay}
|
||||||
storage={storage}
|
key={key}
|
||||||
folder={folder}
|
handleNoteClick={(e) => this.props.handleNoteClick(e, _index)}
|
||||||
isActive={index === _index}
|
handleNoteContextMenu={() => ''}
|
||||||
onClick={(e) => this.props.handleNoteClick(e, _index)}
|
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user