Skip to content

Commit

Permalink
Update internal links in Dropdowns to allow clicking on the entire span
Browse files Browse the repository at this point in the history
  • Loading branch information
Zack LaVergne committed Jun 24, 2021
1 parent aa66f31 commit cefee23
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions frontend/src/components/dropdown.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Link } from '@reach/router';
import { navigate } from '@reach/router';
import onClickOutside from 'react-click-outside';

import { ChevronDownIcon, CheckIcon } from './svgIcons';
Expand All @@ -18,7 +18,13 @@ class DropdownContent extends React.PureComponent {
handleClick = (data: Object) => {
if (data) {
var label = data.label;
if (!label || !this.props.value || !this.props.onChange) return;
if (!this.props.value || !this.props.onChange) {
if (!label) return;
if (data.href && data.internalLink) {
navigate(data.href)
}
return
}
const value = this.props.value;
let ourObj = data;
if (!ourObj) return;
Expand Down Expand Up @@ -71,10 +77,10 @@ class DropdownContent extends React.PureComponent {
)}
{i.href ? (
i.internalLink ? (
<Link to={i.href} className="link blue-grey">
<>
{i.label}
{this.isActive(i) && <CheckIcon className="red pl4" />}
</Link>
</>
) : (
<a
target={'_blank'}
Expand Down

0 comments on commit cefee23

Please sign in to comment.