mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-14 02:06:29 +00:00
Make InfoButton component stateless
This commit is contained in:
@@ -2,29 +2,15 @@ import React, { PropTypes } from 'react'
|
|||||||
import CSSModules from 'browser/lib/CSSModules'
|
import CSSModules from 'browser/lib/CSSModules'
|
||||||
import styles from './InfoButton.styl'
|
import styles from './InfoButton.styl'
|
||||||
|
|
||||||
class InfoButton extends React.Component {
|
const InfoButton = ({
|
||||||
constructor (props) {
|
onClick
|
||||||
super(props)
|
}) => (
|
||||||
|
|
||||||
this.handleInfoButtonClick = this.handleInfoButtonClick.bind(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
handleInfoButtonClick (e) {
|
|
||||||
e.preventDefault()
|
|
||||||
const infoPanel= document.querySelector('.infoPanel')
|
|
||||||
infoPanel.style.display = display === 'none' ? 'inline' : 'none'
|
|
||||||
}
|
|
||||||
|
|
||||||
render () {
|
|
||||||
return (
|
|
||||||
<button styleName='control-infoButton'
|
<button styleName='control-infoButton'
|
||||||
onClick={(e) => this.handleInfoButtonClick(e)}
|
onClick={(e) => onClick(e)}
|
||||||
>
|
>
|
||||||
<i className='fa fa-info-circle infoButton' styleName='info-button' />
|
<i className='fa fa-info-circle infoButton' styleName='info-button' />
|
||||||
</button>
|
</button>
|
||||||
)
|
)
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
InfoButton.propTypes = {
|
InfoButton.propTypes = {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -232,6 +232,11 @@ class MarkdownNoteDetail extends React.Component {
|
|||||||
this.focus()
|
this.focus()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleInfoButtonClick (e) {
|
||||||
|
const infoPanel= document.querySelector('.infoPanel')
|
||||||
|
infoPanel.style.display = display === 'none' ? 'inline' : 'none'
|
||||||
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
let { data, config, location } = this.props
|
let { data, config, location } = this.props
|
||||||
let { note } = this.state
|
let { note } = this.state
|
||||||
@@ -303,7 +308,9 @@ class MarkdownNoteDetail extends React.Component {
|
|||||||
>
|
>
|
||||||
<i className='fa fa-arrows-alt' styleName='fullScreen-button' />
|
<i className='fa fa-arrows-alt' styleName='fullScreen-button' />
|
||||||
</button>
|
</button>
|
||||||
<InfoButton />
|
<InfoButton
|
||||||
|
onClick={this.handleInfoButtonClick()}
|
||||||
|
/>
|
||||||
<InfoPanel
|
<InfoPanel
|
||||||
storageName={currentOption.storage.name}
|
storageName={currentOption.storage.name}
|
||||||
folderName={currentOption.folder.name}
|
folderName={currentOption.folder.name}
|
||||||
|
|||||||
Reference in New Issue
Block a user