1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-11 05:40:11 +02:00

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

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} />
) : (