mirror of
https://github.com/yldio/copilot.git
synced 2024-12-29 05:10:05 +02:00
fix incorrect map of anchor to Link
This commit is contained in:
parent
1fdae858f3
commit
70b640fddf
@ -33,7 +33,7 @@ const Projects = ({
|
||||
{empty}
|
||||
<Row>
|
||||
<Column xs={12}>
|
||||
<Button to={`/${org.id}/new-project`} rr>
|
||||
<Button to={`/${org.id}/new-project`}>
|
||||
<FormattedMessage id='create-new' />
|
||||
</Button>
|
||||
</Column>
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { colors, boxes } from '../../shared/constants';
|
||||
import { Baseline, typography, paperEffect } from '../../shared/composers';
|
||||
import { remcalc } from '../../shared/functions';
|
||||
import isString from 'lodash.isstring';
|
||||
import match from '../../shared/match';
|
||||
import React from 'react';
|
||||
import styled, { css } from 'styled-components';
|
||||
@ -140,7 +139,7 @@ const StyledButton = styled.button`
|
||||
}
|
||||
`;
|
||||
|
||||
const StyledAnchor = styled(Link)`
|
||||
const StyledAnchor = styled.a`
|
||||
display: inline-block;
|
||||
${style}
|
||||
`;
|
||||
@ -151,25 +150,15 @@ const StyledLink = styled(Link)`
|
||||
`;
|
||||
|
||||
const Button = (props) => {
|
||||
// support FormattedMessage
|
||||
if (isString(props)) {
|
||||
return (
|
||||
<StyledButton>
|
||||
{props}
|
||||
</StyledButton>
|
||||
);
|
||||
}
|
||||
|
||||
const {
|
||||
href = '',
|
||||
to = '',
|
||||
rr = false
|
||||
to = ''
|
||||
} = props;
|
||||
|
||||
const Views = [
|
||||
() => !to && !href ? StyledButton : null,
|
||||
() => !rr ? StyledAnchor : null,
|
||||
() => StyledLink
|
||||
() => to ? StyledLink : null,
|
||||
() => href ? StyledAnchor : null,
|
||||
() => StyledButton
|
||||
];
|
||||
|
||||
const View = Views.reduce((sel, view) => sel ? sel : view(), null);
|
||||
@ -184,7 +173,6 @@ const Button = (props) => {
|
||||
Button.propTypes = {
|
||||
children: React.PropTypes.node,
|
||||
href: React.PropTypes.string,
|
||||
rr: React.PropTypes.bool,
|
||||
to: React.PropTypes.string
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user