Skip to content

Commit 699006a

Browse files
committed
Improve ui of colored tags
1 parent 6367be2 commit 699006a

File tree

6 files changed

+40
-14
lines changed

6 files changed

+40
-14
lines changed

browser/components/ColorPicker.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,24 @@ import { SketchPicker } from 'react-color'
44
import CSSModules from 'browser/lib/CSSModules'
55
import styles from './ColorPicker.styl'
66

7-
const componentHeight = 333
7+
const componentHeight = 330
88

99
class ColorPicker extends React.Component {
1010
constructor (props) {
1111
super(props)
1212

1313
this.state = {
14-
color: this.props.color || '#888888'
14+
color: this.props.color || '#939395'
1515
}
1616

1717
this.onColorChange = this.onColorChange.bind(this)
1818
this.handleConfirm = this.handleConfirm.bind(this)
1919
}
2020

21+
componentWillReceiveProps (nextProps) {
22+
this.onColorChange(nextProps.color)
23+
}
24+
2125
onColorChange (color) {
2226
this.setState({
2327
color
@@ -41,6 +45,7 @@ class ColorPicker extends React.Component {
4145

4246
return (
4347
<div styleName='colorPicker' style={{top: `${alignY}px`, left: `${alignX}px`}}>
48+
<div styleName='cover' onClick={onCancel} />
4449
<SketchPicker color={color} onChange={this.onColorChange} />
4550
<div styleName='footer'>
4651
<button styleName='btn-reset' onClick={onReset}>Reset</button>

browser/components/ColorPicker.styl

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,37 @@
11
.colorPicker
22
position fixed
3-
z-index 10000
3+
z-index 2
44
display flex
55
flex-direction column
6+
7+
.cover
8+
position fixed
9+
top 0
10+
right 0
11+
bottom 0
12+
left 0
13+
614
.footer
715
display flex
816
justify-content center
17+
z-index 2
918
align-items center
10-
padding 5px
1119
& > button + button
1220
margin-left 10px
1321

1422
.btn-cancel,
1523
.btn-confirm,
1624
.btn-reset
17-
height 1.6em
18-
border 1px solid #888888
19-
background-color #fff
20-
font-size 15px
25+
vertical-align middle
26+
height 25px
27+
margin-top 2.5px
28+
colorDefaultButton()
2129
border-radius 2px
30+
border $ui-border
31+
padding 0 5px
2232
.btn-confirm
2333
background-color #1EC38B
34+
&:hover
35+
background-color darken(#1EC38B, 25%)
2436

2537

browser/components/TagListItem.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import CSSModules from 'browser/lib/CSSModules'
1010
* @param {string} name
1111
* @param {Function} handleClickTagListItem
1212
* @param {Function} handleClickNarrowToTag
13-
* @param {bool} isActive
14-
* @param {bool} isRelated
13+
* @param {boolean} isActive
14+
* @param {boolean} isRelated
1515
* @param {string} bgColor tab backgroundColor
1616
*/
1717

@@ -24,7 +24,8 @@ const TagListItem = ({name, handleClickTagListItem, handleClickNarrowToTag, hand
2424
: <div styleName={isActive ? 'tagList-itemNarrow-active' : 'tagList-itemNarrow'} />
2525
}
2626
<button styleName={isActive ? 'tagList-item-active' : 'tagList-item'} onClick={() => handleClickTagListItem(name)}>
27-
<span styleName='tagList-item-name' style={{color}}>
27+
<span styleName='tagList-item-color' style={{backgroundColor: color || 'transparent'}} />
28+
<span styleName='tagList-item-name'>
2829
{`# ${name}`}
2930
<span styleName='tagList-item-count'>{count !== 0 ? count : ''}</span>
3031
</span>

browser/components/TagListItem.styl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@
7171
padding-right 15px
7272
font-size 13px
7373

74+
.tagList-item-color
75+
height 26px
76+
width 3px
77+
display inline-block
78+
7479
body[data-theme="white"]
7580
.tagList-item
7681
color $ui-inactive-text-color

browser/main/modals/PreferencesModal/FolderItem.styl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
.folderItem-right-button
6363
vertical-align middle
6464
height 25px
65-
margin-top 2.5px
65+
margin-top 2px
6666
colorDefaultButton()
6767
border-radius 2px
6868
border $ui-border

tests/components/__snapshots__/TagListItem.snapshot.test.js.snap

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@ exports[`TagListItem renders correctly 1`] = `
1313
onClick={[Function]}
1414
>
1515
<span
16-
className="tagList-item-name"
16+
className="tagList-item-color"
1717
style={
1818
Object {
19-
"color": "#000",
19+
"backgroundColor": "#000",
2020
}
2121
}
22+
/>
23+
<span
24+
className="tagList-item-name"
2225
>
2326
# Test
2427
<span

0 commit comments

Comments
 (0)