1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 09:46:22 +00:00

lint colorpicker code

This commit is contained in:
Dick Choi
2016-09-01 00:49:25 +09:00
parent 0d573651a3
commit 4ee49d5991
2 changed files with 17 additions and 14 deletions

View File

@@ -55,10 +55,10 @@ class UnstyledFolderItem extends React.Component {
handleColorButtonClick (e) { handleColorButtonClick (e) {
const folder = Object.assign({}, this.state.folder, { showColumnPicker: true, colorPickerPos: { left: 0, top: 0 } }) const folder = Object.assign({}, this.state.folder, { showColumnPicker: true, colorPickerPos: { left: 0, top: 0 } })
this.setState({ folder }, function() { this.setState({ folder }, function () {
// After the color picker has been painted, re-calculate its position // After the color picker has been painted, re-calculate its position
// by comparing its dimensions to the host dimensions. // by comparing its dimensions to the host dimensions.
const { hostBoundingBox } = this.props; const { hostBoundingBox } = this.props
const colorPickerNode = ReactDOM.findDOMNode(this.refs.colorPicker) const colorPickerNode = ReactDOM.findDOMNode(this.refs.colorPicker)
const colorPickerBox = colorPickerNode.getBoundingClientRect() const colorPickerBox = colorPickerNode.getBoundingClientRect()
const offsetTop = hostBoundingBox.bottom - colorPickerBox.bottom const offsetTop = hostBoundingBox.bottom - colorPickerBox.bottom
@@ -103,19 +103,22 @@ class UnstyledFolderItem extends React.Component {
<button styleName='folderList-item-left-colorButton' style={{color: this.state.folder.color}} <button styleName='folderList-item-left-colorButton' style={{color: this.state.folder.color}}
onClick={(e) => !this.state.folder.showColumnPicker && this.handleColorButtonClick(e)} onClick={(e) => !this.state.folder.showColumnPicker && this.handleColorButtonClick(e)}
> >
{ this.state.folder.showColumnPicker ? {this.state.folder.showColumnPicker
<div style={ popover }> ? <div style={popover}>
<div style={ cover } <div style={cover}
onClick={ () => this.handleColorPickerClose() } /> onClick={() => this.handleColorPickerClose()}
/>
<div style={pickerStyle}> <div style={pickerStyle}>
<SketchPicker <SketchPicker
ref="colorPicker" ref='colorPicker'
color={this.state.folder.color} color={this.state.folder.color}
onChange={ (color) => this.handleColorChange(color) } onChange={(color) => this.handleColorChange(color)}
onChangeComplete={ (color) => this.handleColorChange(color) } /> onChangeComplete={(color) => this.handleColorChange(color)}
/>
</div> </div>
</div> </div>
: null } : null
}
<i className='fa fa-square'/> <i className='fa fa-square'/>
</button> </button>
<input styleName='folderList-item-left-nameInput' <input styleName='folderList-item-left-nameInput'

View File

@@ -33,8 +33,8 @@ class Preferences extends React.Component {
} }
renderContent () { renderContent () {
const { boundingBox } = this.state; const { boundingBox } = this.state
let { dispatch, config, storages } = this.props let { dispatch, config, data } = this.props
switch (this.state.currentTab) { switch (this.state.currentTab) {
case 'INFO': case 'INFO':
@@ -51,7 +51,7 @@ class Preferences extends React.Component {
return ( return (
<StoragesTab <StoragesTab
dispatch={dispatch} dispatch={dispatch}
storages={storages} data={data}
boundingBox={boundingBox} boundingBox={boundingBox}
/> />
) )
@@ -66,7 +66,7 @@ class Preferences extends React.Component {
getContentBoundingBox () { getContentBoundingBox () {
const node = ReactDOM.findDOMNode(this.refs.content) const node = ReactDOM.findDOMNode(this.refs.content)
return node.getBoundingClientRect(); return node.getBoundingClientRect()
} }
render () { render () {