summaryrefslogtreecommitdiffhomepage
path: root/app/components/AppButton.js
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2018-07-20 15:35:44 +0200
committerAndrej Mihajlov <and@mullvad.net>2018-07-24 13:48:18 +0200
commitb45bc31c0b6a3c248c64da3cd75f9e10607bdc8a (patch)
tree38f1972ac884b6372ec38becd68144af20c18b57 /app/components/AppButton.js
parent4b15132791c45c6d5675dbb39c74c5a6d257d458 (diff)
downloadmullvadvpn-b45bc31c0b6a3c248c64da3cd75f9e10607bdc8a.tar.xz
mullvadvpn-b45bc31c0b6a3c248c64da3cd75f9e10607bdc8a.zip
Remove global styles from app buttons
Diffstat (limited to 'app/components/AppButton.js')
-rw-r--r--app/components/AppButton.js23
1 files changed, 14 insertions, 9 deletions
diff --git a/app/components/AppButton.js b/app/components/AppButton.js
index 1b8f50cad2..af8f36b47c 100644
--- a/app/components/AppButton.js
+++ b/app/components/AppButton.js
@@ -7,12 +7,17 @@ import Img from './Img';
export class Label extends Text {}
-class BaseButton extends Component {
- props: {
- children?: React.Node,
- disabled: boolean,
- };
+type Props = {
+ children?: React.Node,
+ style?: Object,
+ disabled: boolean,
+};
+type State = {
+ hovered: boolean,
+};
+
+class BaseButton extends Component<Props, State> {
state = { hovered: false };
textStyle = () => styles.white;
@@ -22,13 +27,13 @@ class BaseButton extends Component {
onHoverStart = () => (!this.props.disabled ? this.setState({ hovered: true }) : null);
onHoverEnd = () => (!this.props.disabled ? this.setState({ hovered: false }) : null);
render() {
- const { children, ...otherProps } = this.props;
+ const { children, style, ...otherProps } = this.props;
return (
<Button
- style={[styles.common, this.backgroundStyle()]}
+ {...otherProps}
+ style={[styles.common, this.backgroundStyle(), style]}
onHoverStart={this.onHoverStart}
- onHoverEnd={this.onHoverEnd}
- {...otherProps}>
+ onHoverEnd={this.onHoverEnd}>
{React.Children.map(children, (node) => {
if (React.isValidElement(node)) {
let updatedProps = {};