Convert LineGraphColorSelector to TypeScript
parent
4fc92a3f21
commit
f1e6320d92
|
@ -1,24 +1,21 @@
|
||||||
import React, {Component} from 'react'
|
import React, {Component} from 'react'
|
||||||
import PropTypes from 'prop-types'
|
|
||||||
import {connect} from 'react-redux'
|
import {connect} from 'react-redux'
|
||||||
import {bindActionCreators} from 'redux'
|
import {bindActionCreators} from 'redux'
|
||||||
|
|
||||||
import ColorScaleDropdown from 'shared/components/ColorScaleDropdown'
|
import ColorScaleDropdown from 'src/shared/components/ColorScaleDropdown'
|
||||||
|
|
||||||
import {updateLineColors} from 'src/dashboards/actions/cellEditorOverlay'
|
import {updateLineColors} from 'src/dashboards/actions/cellEditorOverlay'
|
||||||
import {colorsStringSchema} from 'shared/schemas'
|
import {ColorNumber} from 'src/types/colors'
|
||||||
import {ErrorHandling} from 'src/shared/decorators/errors'
|
import {ErrorHandling} from 'src/shared/decorators/errors'
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
lineColors: ColorNumber[]
|
||||||
|
handleUpdateLineColors: (colors: ColorNumber[]) => void
|
||||||
|
}
|
||||||
|
|
||||||
@ErrorHandling
|
@ErrorHandling
|
||||||
class LineGraphColorSelector extends Component {
|
class LineGraphColorSelector extends Component<Props> {
|
||||||
handleSelectColors = colorScale => {
|
public render() {
|
||||||
const {handleUpdateLineColors} = this.props
|
|
||||||
const {colors} = colorScale
|
|
||||||
|
|
||||||
handleUpdateLineColors(colors)
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const {lineColors} = this.props
|
const {lineColors} = this.props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -32,13 +29,13 @@ class LineGraphColorSelector extends Component {
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
const {func} = PropTypes
|
public handleSelectColors = colorScale => {
|
||||||
|
const {handleUpdateLineColors} = this.props
|
||||||
|
const {colors} = colorScale
|
||||||
|
|
||||||
LineGraphColorSelector.propTypes = {
|
handleUpdateLineColors(colors)
|
||||||
lineColors: colorsStringSchema.isRequired,
|
}
|
||||||
handleUpdateLineColors: func.isRequired,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapStateToProps = ({cellEditorOverlay: {lineColors}}) => ({
|
const mapStateToProps = ({cellEditorOverlay: {lineColors}}) => ({
|
Loading…
Reference in New Issue