1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-24 09:18:09 +00:00

Use Link instead of <a/>

This commit is contained in:
Vasek Mlejnsky 2018-08-24 08:45:00 +02:00
parent aa6e37fc38
commit 58666ceb45
2 changed files with 12 additions and 6 deletions

View File

@ -1,10 +1,12 @@
import styled from 'styled-components'; import styled from 'styled-components';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import React from 'react'; import React from 'react';
import Link from 'components/Link';
import { getYear } from 'date-fns'; import { getYear } from 'date-fns';
import { bindActionCreators } from 'redux'; import { bindActionCreators } from 'redux';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import colors from 'config/colors'; import colors from 'config/colors';
import * as LogActions from 'actions/LogActions'; import * as LogActions from 'actions/LogActions';
@ -17,7 +19,7 @@ const Wrapper = styled.div`
display: flex; display: flex;
`; `;
const A = styled.a` const LinkWrapper = styled(Link)`
margin: 0 6px; margin: 0 6px;
margin-right: 20px; margin-right: 20px;
`; `;
@ -29,9 +31,9 @@ const Copy = styled.div`
const Footer = ({ toggle }) => ( const Footer = ({ toggle }) => (
<Wrapper> <Wrapper>
<Copy>&copy; {getYear(new Date())}</Copy> <Copy>&copy; {getYear(new Date())}</Copy>
<A href="http://satoshilabs.com" target="_blank" rel="noreferrer noopener" className="satoshi green">SatoshiLabs</A> <LinkWrapper href="http://satoshilabs.com" target="_blank" rel="noreferrer noopener" className="satoshi" isGreen>SatoshiLabs</LinkWrapper>
<A href="tos.pdf" target="_blank" rel="noreferrer noopener" className="green">Terms</A> <LinkWrapper href="tos.pdf" target="_blank" rel="noreferrer noopener" isGreen>Terms</LinkWrapper>
<A onClick={toggle} className="green">Show Log</A> <LinkWrapper onClick={toggle} isGreen>Show Log</LinkWrapper>
</Wrapper> </Wrapper>
); );

View File

@ -47,12 +47,14 @@ const A = styled.a`
`; `;
const Link = ({ const Link = ({
children, href, target, rel, isGreen = false, isGray = false, children, className, href, target, rel, onClick, isGreen = false, isGray = false,
}) => ( }) => (
<A <A
className={className}
href={href} href={href}
target={target} target={target}
rel={rel} rel={rel}
onClick={onClick}
isGreen={isGreen} isGreen={isGreen}
isGray={isGray} isGray={isGray}
>{children} >{children}
@ -65,9 +67,11 @@ Link.propTypes = {
PropTypes.object, PropTypes.object,
PropTypes.array, PropTypes.array,
]).isRequired, ]).isRequired,
href: PropTypes.string.isRequired, className: PropTypes.string,
href: PropTypes.string,
target: PropTypes.string, target: PropTypes.string,
rel: PropTypes.string, rel: PropTypes.string,
onClick: PropTypes.func,
isGreen: PropTypes.bool, isGreen: PropTypes.bool,
isGray: PropTypes.bool, isGray: PropTypes.bool,
}; };