1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-28 14:10:04 +02:00

adding "to" prop to allow for button to use react-router correctly

This commit is contained in:
Alex Windett 2017-02-28 12:22:48 +00:00
parent 5b4887d18b
commit eb742b6266
2 changed files with 6 additions and 4 deletions

View File

@ -33,7 +33,7 @@ const Projects = ({
{empty}
<Row>
<Column xs={12}>
<Button href={`/${org.id}/new-project`}>
<Button to={`/${org.id}/new-project`}>
<FormattedMessage id='create-new' />
</Button>
</Column>

View File

@ -125,7 +125,7 @@ const StyledButton = styled.button`
}
`;
const StyledAnchor = styled.a`
const StyledAnchor = styled(Link)`
display: inline-block;
${style}
`;
@ -147,11 +147,12 @@ const Button = (props) => {
const {
href = '',
to = '',
rr = false
} = props;
const Views = [
() => !href ? StyledButton : null,
() => !to || !href ? StyledButton : null,
() => !rr ? StyledAnchor : null,
() => StyledLink
];
@ -165,7 +166,8 @@ const Button = (props) => {
Button.propTypes = {
href: React.PropTypes.string,
rr: React.PropTypes.bool
rr: React.PropTypes.bool,
to: React.PropTypes.string
};
export default Baseline(