allow to use button as a function

This commit is contained in:
Sérgio Ramos 2017-01-09 12:37:05 +00:00
parent 69627def2a
commit 77ac03962e
1 changed files with 10 additions and 0 deletions

View File

@ -1,5 +1,6 @@
const constants = require('../../shared/constants');
const fns = require('../../shared/functions');
const isString = require('lodash.isstring');
const match = require('../../shared/match');
const React = require('react');
const Styled = require('styled-components');
@ -139,6 +140,15 @@ const StyledAnchor = styled.a`
const Button = (props) => {
// support FormattedMessage
if (isString(props)) {
return (
<StyledButton>
{props}
</StyledButton>
);
}
return props.href ? (
<StyledAnchor {...props} />
) : (