Replace the a tag with an ExternalLink component.

This lets us handle behaviour more consistently, for example by opening
external links in a new tab.
master
Tom Hacohen 7 years ago
parent ec8a1d9017
commit a32002eabd

@ -3,6 +3,7 @@ import { connect } from 'react-redux';
import { withRouter } from 'react-router'; import { withRouter } from 'react-router';
import Container from './widgets/Container'; import Container from './widgets/Container';
import ExternalLink from './widgets/ExternalLink';
import SyncGate from './SyncGate'; import SyncGate from './SyncGate';
import LoginForm from './components/LoginForm'; import LoginForm from './components/LoginForm';
@ -49,8 +50,10 @@ class Root extends React.PureComponent {
/> />
<hr style={style.divider}/> <hr style={style.divider}/>
<ul> <ul>
<li><a style={style.isSafe} href={C.faq + '#web-client'}>Is the web client safe to use?</a></li> <li><ExternalLink style={style.isSafe} href={C.faq + '#web-client'}>
<li><a style={style.isSafe} href={C.sourceCode}>Source code</a></li> Is the web client safe to use?
</ExternalLink></li>
<li><ExternalLink style={style.isSafe} href={C.sourceCode}>Source code</ExternalLink></li>
</ul> </ul>
</Container> </Container>
); );

@ -3,6 +3,8 @@ import RaisedButton from 'material-ui/RaisedButton';
import TextField from 'material-ui/TextField'; import TextField from 'material-ui/TextField';
import Toggle from 'material-ui/Toggle'; import Toggle from 'material-ui/Toggle';
import ExternalLink from '../widgets/ExternalLink';
import { getPalette } from '../App'; import { getPalette } from '../App';
import * as C from '../constants'; import * as C from '../constants';
@ -148,7 +150,7 @@ class LoginForm extends React.PureComponent {
onChange={this.handleInputChange} onChange={this.handleInputChange}
/> />
<div style={styles.forgotPassword}> <div style={styles.forgotPassword}>
<a href={C.forgotPassword}>Forgot password?</a> <ExternalLink href={C.forgotPassword}>Forgot password?</ExternalLink>
</div> </div>
<TextField <TextField
type="password" type="password"

@ -0,0 +1,8 @@
import * as React from 'react';
import { pure } from 'recompose';
export const ExternalLink = pure((props: any) => (
<a target="_blank" {...props} />
));
export default ExternalLink;

@ -1,6 +1,8 @@
import * as React from 'react'; import * as React from 'react';
import { pure } from 'recompose'; import { pure } from 'recompose';
import ExternalLink from './ExternalLink';
import './List.css'; import './List.css';
export const ListItemRaw = pure((_props: any) => { export const ListItemRaw = pure((_props: any) => {
@ -14,9 +16,9 @@ export const ListItemRaw = pure((_props: any) => {
const inner = href ? const inner = href ?
( (
<a href={href} className="ListItem-href"> <ExternalLink href={href} className="ListItem-href">
{children} {children}
</a> </ExternalLink>
) : ) :
children children
; ;

Loading…
Cancel
Save