summaryrefslogtreecommitdiffhomepage
path: root/app/components/styled/Button.js
blob: df880701cd9c9d8dcd74c88fa99ac12698ec3c7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// @flow

import React from 'react';
import ReactXP from 'reactxp';

const defaultStyle = ReactXP.Styles.createViewStyle({
  cursor: 'default',
});

export function Button(props: *) {
  const { style, cursor, ...rest } = props;

  const stylePropArray = Array.isArray(props.style)
    ? props.style
    : [props.style];

  const concreteStyle = ReactXP.Styles.combine([defaultStyle, ...stylePropArray]);

  // Can be removed when we upgrade to ReactXP 0.51
  const concreteCursor = cursor || concreteStyle.cursor || 'default';

  return <ReactXP.Button style={concreteStyle} cursor={concreteCursor} {...rest} />;
}