From 73240d91650881ca982210dd7051b5ed6e694dd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81rgio=20Ramos?= Date: Mon, 9 Jan 2017 12:01:26 +0000 Subject: [PATCH] anchor button --- ui/src/components/button/index.js | 48 +++++++++++++++++++++++++++++-- ui/stories/index.js | 6 ++++ 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/ui/src/components/button/index.js b/ui/src/components/button/index.js index 598f2cd1..ef70bd25 100644 --- a/ui/src/components/button/index.js +++ b/ui/src/components/button/index.js @@ -1,6 +1,7 @@ const constants = require('../../shared/constants'); const fns = require('../../shared/functions'); const match = require('../../shared/match'); +const React = require('react'); const Styled = require('styled-components'); const { @@ -13,7 +14,8 @@ const { } = fns; const { - default: styled + default: styled, + css } = Styled; const background = match({ @@ -56,17 +58,33 @@ const borderRadius = match({ }, remcalc(boxes.borderRadius)); // based on bootstrap 4 -module.exports = styled.button` +const style = css` + box-sizing: border-box; display: flex; justify-content: center; align-items: center; - margin-bottom: 0; + margin: 0; padding: ${remcalc('14 16')}; + position: relative; + + font-family: -apple-system, + BlinkMacSystemFont, + "Segoe UI", + Roboto, + "Helvetica Neue", + Arial, + sans-serif; font-size: ${remcalc(16)}; font-weight: 400; text-align: center; + font-style: normal; + font-weight: normal; + font-stretch: normal; + line-height: normal; + letter-spacing: normal; + text-decoration: none; white-space: nowrap; vertical-align: middle; @@ -109,3 +127,27 @@ module.exports = styled.button` pointer-events: none; } `; + +const StyledButton = styled.button` + ${style} +`; + +const StyledAnchor = styled.a` + display: inline-block !important; + ${style} +`; + + +const Button = (props) => { + return props.href ? ( + + ) : ( + + ); +}; + +Button.propTypes = { + href: React.PropTypes.string +}; + +module.exports = Button; diff --git a/ui/stories/index.js b/ui/stories/index.js index b23bcbf1..4147d337 100644 --- a/ui/stories/index.js +++ b/ui/stories/index.js @@ -131,6 +131,12 @@ storiesOf('Button', module) + )).add('Anchor', () => ( +
+ +
)); storiesOf('Checkbox', module)