mirror of
https://github.com/yldio/copilot.git
synced 2024-11-13 06:40:06 +02:00
allow to use button as a function
This commit is contained in:
parent
69627def2a
commit
77ac03962e
@ -1,5 +1,6 @@
|
|||||||
const constants = require('../../shared/constants');
|
const constants = require('../../shared/constants');
|
||||||
const fns = require('../../shared/functions');
|
const fns = require('../../shared/functions');
|
||||||
|
const isString = require('lodash.isstring');
|
||||||
const match = require('../../shared/match');
|
const match = require('../../shared/match');
|
||||||
const React = require('react');
|
const React = require('react');
|
||||||
const Styled = require('styled-components');
|
const Styled = require('styled-components');
|
||||||
@ -139,6 +140,15 @@ const StyledAnchor = styled.a`
|
|||||||
|
|
||||||
|
|
||||||
const Button = (props) => {
|
const Button = (props) => {
|
||||||
|
// support FormattedMessage
|
||||||
|
if (isString(props)) {
|
||||||
|
return (
|
||||||
|
<StyledButton>
|
||||||
|
{props}
|
||||||
|
</StyledButton>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return props.href ? (
|
return props.href ? (
|
||||||
<StyledAnchor {...props} />
|
<StyledAnchor {...props} />
|
||||||
) : (
|
) : (
|
||||||
|
Loading…
Reference in New Issue
Block a user