mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
Improve ui of colored tags
This commit is contained in:
@@ -4,20 +4,24 @@ import { SketchPicker } from 'react-color'
|
|||||||
import CSSModules from 'browser/lib/CSSModules'
|
import CSSModules from 'browser/lib/CSSModules'
|
||||||
import styles from './ColorPicker.styl'
|
import styles from './ColorPicker.styl'
|
||||||
|
|
||||||
const componentHeight = 333
|
const componentHeight = 330
|
||||||
|
|
||||||
class ColorPicker extends React.Component {
|
class ColorPicker extends React.Component {
|
||||||
constructor (props) {
|
constructor (props) {
|
||||||
super(props)
|
super(props)
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
color: this.props.color || '#888888'
|
color: this.props.color || '#939395'
|
||||||
}
|
}
|
||||||
|
|
||||||
this.onColorChange = this.onColorChange.bind(this)
|
this.onColorChange = this.onColorChange.bind(this)
|
||||||
this.handleConfirm = this.handleConfirm.bind(this)
|
this.handleConfirm = this.handleConfirm.bind(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps (nextProps) {
|
||||||
|
this.onColorChange(nextProps.color)
|
||||||
|
}
|
||||||
|
|
||||||
onColorChange (color) {
|
onColorChange (color) {
|
||||||
this.setState({
|
this.setState({
|
||||||
color
|
color
|
||||||
@@ -41,6 +45,7 @@ class ColorPicker extends React.Component {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div styleName='colorPicker' style={{top: `${alignY}px`, left: `${alignX}px`}}>
|
<div styleName='colorPicker' style={{top: `${alignY}px`, left: `${alignX}px`}}>
|
||||||
|
<div styleName='cover' onClick={onCancel} />
|
||||||
<SketchPicker color={color} onChange={this.onColorChange} />
|
<SketchPicker color={color} onChange={this.onColorChange} />
|
||||||
<div styleName='footer'>
|
<div styleName='footer'>
|
||||||
<button styleName='btn-reset' onClick={onReset}>Reset</button>
|
<button styleName='btn-reset' onClick={onReset}>Reset</button>
|
||||||
|
|||||||
@@ -1,25 +1,37 @@
|
|||||||
.colorPicker
|
.colorPicker
|
||||||
position fixed
|
position fixed
|
||||||
z-index 10000
|
z-index 2
|
||||||
display flex
|
display flex
|
||||||
flex-direction column
|
flex-direction column
|
||||||
|
|
||||||
|
.cover
|
||||||
|
position fixed
|
||||||
|
top 0
|
||||||
|
right 0
|
||||||
|
bottom 0
|
||||||
|
left 0
|
||||||
|
|
||||||
.footer
|
.footer
|
||||||
display flex
|
display flex
|
||||||
justify-content center
|
justify-content center
|
||||||
|
z-index 2
|
||||||
align-items center
|
align-items center
|
||||||
padding 5px
|
|
||||||
& > button + button
|
& > button + button
|
||||||
margin-left 10px
|
margin-left 10px
|
||||||
|
|
||||||
.btn-cancel,
|
.btn-cancel,
|
||||||
.btn-confirm,
|
.btn-confirm,
|
||||||
.btn-reset
|
.btn-reset
|
||||||
height 1.6em
|
vertical-align middle
|
||||||
border 1px solid #888888
|
height 25px
|
||||||
background-color #fff
|
margin-top 2.5px
|
||||||
font-size 15px
|
colorDefaultButton()
|
||||||
border-radius 2px
|
border-radius 2px
|
||||||
|
border $ui-border
|
||||||
|
padding 0 5px
|
||||||
.btn-confirm
|
.btn-confirm
|
||||||
background-color #1EC38B
|
background-color #1EC38B
|
||||||
|
&:hover
|
||||||
|
background-color darken(#1EC38B, 25%)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import CSSModules from 'browser/lib/CSSModules'
|
|||||||
* @param {string} name
|
* @param {string} name
|
||||||
* @param {Function} handleClickTagListItem
|
* @param {Function} handleClickTagListItem
|
||||||
* @param {Function} handleClickNarrowToTag
|
* @param {Function} handleClickNarrowToTag
|
||||||
* @param {bool} isActive
|
* @param {boolean} isActive
|
||||||
* @param {bool} isRelated
|
* @param {boolean} isRelated
|
||||||
* @param {string} bgColor tab backgroundColor
|
* @param {string} bgColor tab backgroundColor
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -24,7 +24,8 @@ const TagListItem = ({name, handleClickTagListItem, handleClickNarrowToTag, hand
|
|||||||
: <div styleName={isActive ? 'tagList-itemNarrow-active' : 'tagList-itemNarrow'} />
|
: <div styleName={isActive ? 'tagList-itemNarrow-active' : 'tagList-itemNarrow'} />
|
||||||
}
|
}
|
||||||
<button styleName={isActive ? 'tagList-item-active' : 'tagList-item'} onClick={() => handleClickTagListItem(name)}>
|
<button styleName={isActive ? 'tagList-item-active' : 'tagList-item'} onClick={() => handleClickTagListItem(name)}>
|
||||||
<span styleName='tagList-item-name' style={{color}}>
|
<span styleName='tagList-item-color' style={{backgroundColor: color || 'transparent'}} />
|
||||||
|
<span styleName='tagList-item-name'>
|
||||||
{`# ${name}`}
|
{`# ${name}`}
|
||||||
<span styleName='tagList-item-count'>{count !== 0 ? count : ''}</span>
|
<span styleName='tagList-item-count'>{count !== 0 ? count : ''}</span>
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -71,6 +71,11 @@
|
|||||||
padding-right 15px
|
padding-right 15px
|
||||||
font-size 13px
|
font-size 13px
|
||||||
|
|
||||||
|
.tagList-item-color
|
||||||
|
height 26px
|
||||||
|
width 3px
|
||||||
|
display inline-block
|
||||||
|
|
||||||
body[data-theme="white"]
|
body[data-theme="white"]
|
||||||
.tagList-item
|
.tagList-item
|
||||||
color $ui-inactive-text-color
|
color $ui-inactive-text-color
|
||||||
|
|||||||
@@ -62,7 +62,7 @@
|
|||||||
.folderItem-right-button
|
.folderItem-right-button
|
||||||
vertical-align middle
|
vertical-align middle
|
||||||
height 25px
|
height 25px
|
||||||
margin-top 2.5px
|
margin-top 2px
|
||||||
colorDefaultButton()
|
colorDefaultButton()
|
||||||
border-radius 2px
|
border-radius 2px
|
||||||
border $ui-border
|
border $ui-border
|
||||||
|
|||||||
@@ -13,12 +13,15 @@ exports[`TagListItem renders correctly 1`] = `
|
|||||||
onClick={[Function]}
|
onClick={[Function]}
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
className="tagList-item-name"
|
className="tagList-item-color"
|
||||||
style={
|
style={
|
||||||
Object {
|
Object {
|
||||||
"color": "#000",
|
"backgroundColor": "#000",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
className="tagList-item-name"
|
||||||
>
|
>
|
||||||
# Test
|
# Test
|
||||||
<span
|
<span
|
||||||
|
|||||||
Reference in New Issue
Block a user