diff options
| author | anderklander <anderklander@gmail.com> | 2018-03-26 09:24:50 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2018-03-26 14:22:11 +0200 |
| commit | ee421d5a90e9a8a98817304573bcb973fb4aab76 (patch) | |
| tree | 735af437bb6fb854a691e34b5fad29708e6834f8 /app/components/styled | |
| parent | c1fd06c609ab5f99e01071c8a9e790950ede9981 (diff) | |
| download | mullvadvpn-ee421d5a90e9a8a98817304573bcb973fb4aab76.tar.xz mullvadvpn-ee421d5a90e9a8a98817304573bcb973fb4aab76.zip | |
cellHoverStyle/hoverStyle
Diffstat (limited to 'app/components/styled')
| -rw-r--r-- | app/components/styled/CellButton.js | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/app/components/styled/CellButton.js b/app/components/styled/CellButton.js index ef96dbce98..196afb574a 100644 --- a/app/components/styled/CellButton.js +++ b/app/components/styled/CellButton.js @@ -73,7 +73,7 @@ export class Label extends Text {} type CellButtonProps = { children?: React.Node, disabled?: boolean, - hoverStyle?: Types.ViewStyle, + cellHoverStyle?: Types.ViewStyle, style?: Types.ViewStyle }; @@ -82,18 +82,18 @@ type State = { hovered: boolean }; export default class CellButton extends Component<CellButtonProps, State> { state = { hovered: false }; - textStyle = (hoverStyle?: Types.ViewStyle) => this.state.hovered ? hoverStyle || styles.white80 : null; - iconStyle = (hoverStyle?: Types.ViewStyle) => this.state.hovered ? hoverStyle || styles.white40 : null; - subtextStyle = (hoverStyle?: Types.ViewStyle) => this.state.hovered ? hoverStyle || styles.white40 : null; - backgroundStyle = (hoverStyle?: Types.ViewStyle) => this.state.hovered ? hoverStyle || styles.blueHover : null; + textStyle = (cellHoverStyle?: Types.ViewStyle) => this.state.hovered ? cellHoverStyle || styles.white80 : null; + iconStyle = (cellHoverStyle?: Types.ViewStyle) => this.state.hovered ? cellHoverStyle || styles.white40 : null; + subtextStyle = (cellHoverStyle?: Types.ViewStyle) => this.state.hovered ? cellHoverStyle || styles.white40 : null; + backgroundStyle = (cellHoverStyle?: Types.ViewStyle) => this.state.hovered ? cellHoverStyle || styles.blueHover : null; onHoverStart = () => !this.props.disabled ? this.setState({ hovered: true }) : null; onHoverEnd = () => !this.props.disabled ? this.setState({ hovered: false }) : null; render() { - const { children, style, hoverStyle, ...otherProps } = this.props; + const { children, style, cellHoverStyle, ...otherProps } = this.props; return ( - <Button style={[ styles.cell, style, this.backgroundStyle(hoverStyle) ]} + <Button style={[ styles.cell, style, this.backgroundStyle(cellHoverStyle) ]} onHoverStart={this.onHoverStart} onHoverEnd={this.onHoverEnd} {...otherProps}> @@ -103,15 +103,15 @@ export default class CellButton extends Component<CellButtonProps, State> { let updatedProps = {}; if(node.type.name === 'Label') { - updatedProps = { style: [styles.label, node.props.style, this.textStyle(node.props.hoverStyle)]}; + updatedProps = { style: [styles.label, node.props.style, this.textStyle(node.props.cellHoverStyle)]}; } if(node.type.name === 'Img') { - updatedProps = { tintColor:'currentColor', style: [styles.icon, node.props.style, this.iconStyle(node.props.hoverStyle)]}; + updatedProps = { tintColor:'currentColor', style: [styles.icon, node.props.style, this.iconStyle(node.props.cellHoverStyle)]}; } if(node.type.name === 'SubText') { - updatedProps = { style: [styles.subtext, node.props.style, this.subtextStyle(node.props.hoverStyle)]}; + updatedProps = { style: [styles.subtext, node.props.style, this.subtextStyle(node.props.cellHoverStyle)]}; } return React.cloneElement(node, updatedProps); |
