1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-10 21:30:06 +02:00

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} {empty}
<Row> <Row>
<Column xs={12}> <Column xs={12}>
<Button href={`/${org.id}/new-project`}> <Button to={`/${org.id}/new-project`}>
<FormattedMessage id='create-new' /> <FormattedMessage id='create-new' />
</Button> </Button>
</Column> </Column>

View File

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