From efcaa53ac0def6c2cd3e3c806008a0bb5313cdbf Mon Sep 17 00:00:00 2001 From: Monia <3ditds@gmail.com> Date: Mon, 25 Feb 2019 15:02:09 +0200 Subject: [PATCH] feat: add link component (#117) --- src/components/button/index.js | 26 ++++-------- src/components/link/index.js | 24 +++++++++++ src/components/modal/index.js | 52 +++++------------------- src/components/taskbar/index.js | 14 +++---- src/views/faq/faq.js | 46 +++++++-------------- src/views/landingpage/landingpage.js | 48 ++++++++++++++++++++-- src/views/refund/steps/completeRefund.js | 12 +++--- 7 files changed, 110 insertions(+), 112 deletions(-) create mode 100644 src/components/link/index.js diff --git a/src/components/button/index.js b/src/components/button/index.js index 1484605..1c17159 100644 --- a/src/components/button/index.js +++ b/src/components/button/index.js @@ -1,12 +1,12 @@ import React from 'react'; import injectSheet from 'react-jss'; import PropTypes from 'prop-types'; - +import Link from '../link'; /* * Link button */ -const LinkBtnStyles = theme => ({ +const ButtonStyles = theme => ({ wrapper: { padding: '10px', color: theme.colors.white, @@ -20,28 +20,16 @@ const LinkBtnStyles = theme => ({ }, }); -const StyledLinkButton = ({ classes, text, to, style, external, onPress }) => +const Button = ({ classes, text, to, style, external, onPress }) => external ? ( - - {text} - + ) : ( - onPress()} - > + onPress()}> {text} ); -StyledLinkButton.propTypes = { +Button.propTypes = { classes: PropTypes.object, external: PropTypes.bool.isRequired, text: PropTypes.string.isRequired, @@ -50,4 +38,4 @@ StyledLinkButton.propTypes = { style: PropTypes.object, }; -export const LinkButton = injectSheet(LinkBtnStyles)(StyledLinkButton); +export default injectSheet(ButtonStyles)(Button); diff --git a/src/components/link/index.js b/src/components/link/index.js new file mode 100644 index 0000000..d5ce426 --- /dev/null +++ b/src/components/link/index.js @@ -0,0 +1,24 @@ +import React from 'react'; +import PropTypes from 'prop-types'; + +const Link = ({ text, style, className, to, openNew = true }) => ( + + {text} + +); + +Link.propTypes = { + text: PropTypes.string.isRequired, + style: PropTypes.object, + className: PropTypes.any, + to: PropTypes.string.isRequired, + openNew: PropTypes.bool, +}; + +export default Link; diff --git a/src/components/modal/index.js b/src/components/modal/index.js index 82c1366..4459685 100644 --- a/src/components/modal/index.js +++ b/src/components/modal/index.js @@ -1,50 +1,18 @@ import React from 'react'; -import Modal from 'react-responsive-modal'; import PropTypes from 'prop-types'; +import Modal from 'react-responsive-modal'; -const ModalComponent = props => { - const { isOpen, onClose } = props; - - return ( - -
-

- On 4th of September 2018, in a{' '} - - blogpost - - , Shapeshift, one of the largest cryptocurrency entities, scummed to - user data collection. -

-

- By creating an account on a custodial exchange like Shapeshift, you - are giving the government and anyone who can access that KYC data, the - power to not only know that you have crypto assets but also to - confiscate them during a trade. -

-

- We built Boltz with a dream of a fairer financial world, with the - primary goal to empower users with financial sovereignty. Therefore,{' '} - - Boltz does not and will never collect any data that could identify - our users. - -

-

- Also, Boltz leverages atomic swaps in a way, so that trades either - complete in full or get refunded. Users can rest assured to be in - possession of their funds at all times, without worrying about who is - behind Boltz and if this entity is trustworthy. -

-

- Trading {`shouldn't`} require an account. -

-
-
- ); -}; +const ModalComponent = ({ isOpen, onClose, children }) => ( + + {children} + +); ModalComponent.propTypes = { + children: PropTypes.oneOfType([ + PropTypes.arrayOf(PropTypes.node), + PropTypes.node, + ]).isRequired, isOpen: PropTypes.bool.isRequired, onClose: PropTypes.func, }; diff --git a/src/components/taskbar/index.js b/src/components/taskbar/index.js index e73fbe1..acaa267 100644 --- a/src/components/taskbar/index.js +++ b/src/components/taskbar/index.js @@ -2,7 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import injectSheet from 'react-jss'; import View from '../view'; -import { LinkButton } from '../button'; +import Button from '../button'; import { network } from '../../constants'; const boltz_logo = require('../../asset/icons/boltz_logo.png'); @@ -57,14 +57,10 @@ const TaskBar = ({ classes, goHome, goRefund, goFaq }) => ( {network} alpha - goHome()} /> - goRefund()} /> - goFaq()} /> - +