Skip to content

Commit

Permalink
Render navigation dropdown options as links instead of buttons. (#17876)
Browse files Browse the repository at this point in the history
  • Loading branch information
linuspahl authored Jan 9, 2024
1 parent a998fa0 commit 88b77e1
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,19 @@
*/
import React from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';

import Menu from 'components/bootstrap/Menu';
import { LinkContainer } from 'components/common/router';
import { NavItem } from 'components/bootstrap';

const DropdownOption = styled(Menu.Item)`
&:hover, &:focus {
color: inherit;
text-decoration: none;
}
`;

// We render a NavItem if topLevel is set to avoid errors when the NavigationLink is place in the navigation
// bar instead of a navigation drop-down menu.
type Props = {
Expand All @@ -31,7 +39,7 @@ type Props = {

const NavigationLink = ({ description, path, topLevel, ...rest }: Props) => (
<LinkContainer key={path} to={path} {...rest}>
{topLevel ? <NavItem>{description}</NavItem> : <Menu.Item>{description}</Menu.Item>}
{topLevel ? <NavItem>{description}</NavItem> : <DropdownOption component="a">{description}</DropdownOption>}
</LinkContainer>
);

Expand Down

0 comments on commit 88b77e1

Please sign in to comment.