From eb742b626647f9755b9bd1d1d6c72fe66d194b35 Mon Sep 17 00:00:00 2001 From: Alex Windett Date: Tue, 28 Feb 2017 12:22:48 +0000 Subject: [PATCH] adding "to" prop to allow for button to use react-router correctly --- frontend/src/containers/projects/index.js | 2 +- ui/src/components/button/index.js | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/src/containers/projects/index.js b/frontend/src/containers/projects/index.js index 9fef2fde..0f34615c 100644 --- a/frontend/src/containers/projects/index.js +++ b/frontend/src/containers/projects/index.js @@ -33,7 +33,7 @@ const Projects = ({ {empty} - diff --git a/ui/src/components/button/index.js b/ui/src/components/button/index.js index 942fad65..7b1d5c2a 100644 --- a/ui/src/components/button/index.js +++ b/ui/src/components/button/index.js @@ -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(