Merge pull request #330 from yldio/fix/ui-button-link

Fix/ui button link
This commit is contained in:
Alex Windett 2017-02-28 16:45:03 +00:00 committed by GitHub
commit 63dec8741f
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(