Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 21 additions & 28 deletions lib/components/Link.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { Link as RouterLink } from 'react-router-dom';
import MuiLink from '@material-ui/core/Link';
import { withStyles } from '@material-ui/core/styles';
import Icon from '@material-ui/core/Icon';

Expand Down Expand Up @@ -43,52 +43,45 @@ const styles = theme => ({
},
});

class Link extends React.Component {
class Link extends Component {
render() {
const {
classes = {},
classes,
children,
component,
to,
onClick,
external,
footer,
tooltip,
external,
onClick,
} = this.props;
return external ? (
<a

return (
<MuiLink
className={classNames(classes.base, {
[classes.baseDefault]: !footer && !tooltip,
[classes.baseFooter]: footer,
[classes.baseTooltip]: tooltip,
[classes.basetooltip]: tooltip,
})}
target="_blank"
rel="noopener noreferrer"
href={to}
component={component}
to={to}
underline="none"
href={external ? to : null}
target={external ? '_blank' : null}
rel={external ? 'noopener noreferrer' : null}
onClick={onClick}
>
{children}
{footer ? null : (
{footer ? null : external ? (
<Icon
className={classNames(
'fa',
'fa-external-link-alt',
classes.externalIcon
)}
/>
)}
</a>
) : (
<RouterLink
className={classNames(classes.base, {
[classes.baseDefault]: !footer && !tooltip,
[classes.baseFooter]: footer,
[classes.basetooltip]: tooltip,
})}
to={to}
onClick={onClick}
>
{children}
</RouterLink>
) : null}
</MuiLink>
);
}
}
Expand All @@ -114,6 +107,6 @@ Link.defaultProps = {
to: '/',
};

export { Link };
// export { Link };

export default withStyles(styles)(Link);
8 changes: 4 additions & 4 deletions lib/components/NavBar.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from 'react';
import { Link } from 'react-router-dom';
import Link from '@material-ui/core/Link';
import AppBar from '@material-ui/core/AppBar';
import Toolbar from '@material-ui/core/Toolbar';
import Button from '@material-ui/core/Button';
import Typography from '@material-ui/core/Typography';
import { withStyles } from '@material-ui/core/styles';
import classNames from 'classnames';
Expand Down Expand Up @@ -65,6 +64,7 @@ const NavBar = ({
docs,
contact,
homepage,
linkComponent,
}) => (
<AppBar
className={classNames(classes.navbar, {
Expand All @@ -76,9 +76,9 @@ const NavBar = ({
>
<Toolbar variant="dense">
{homepage ? null : (
<Button component={Link} to="/" color="inherit">
<Link component={linkComponent} to="/">
<OpenTargetsTitle name={name} />
</Button>
</Link>
)}
<div className={classes.flex} />
{search ? search : null}
Expand Down
2 changes: 2 additions & 0 deletions lib/components/OpenTargetsTitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import classNames from 'classnames';
const styles = () => ({
root: {
display: 'inline',
color: 'white',
paddingLeft: '8px',
},
fat: {
fontWeight: 1100,
Expand Down
3 changes: 2 additions & 1 deletion lib/components/SearchExamples.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import { Link } from 'react-router-dom';
// import { Link } from 'react-router-dom';
import Link from '@material-ui/core/Link';
import { withStyles } from '@material-ui/core/styles';
import Button from '@material-ui/core/Button';

Expand Down
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
"react": "16.8.6",
"react-dom": "16.8.6",
"react-measure": "^2.1.0",
"react-router-dom": "^5.0.1",
"react-select": "^2.0.0",
"typeface-inter": "^3.3.0"
},
Expand All @@ -90,6 +89,5 @@
"!lib/index.js",
"!lib/setupTests.js"
]
},
"dependencies": {}
}
}
Loading