Skip to content

Commit

Permalink
Make species selector button clickable (#1129)
Browse files Browse the repository at this point in the history
  • Loading branch information
jyothishnt authored May 9, 2024
1 parent 7703df9 commit 9285608
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/header/launchbar/LaunchbarButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export type LaunchbarButtonProps = {
icon: FunctionComponent<unknown>;
enabled?: boolean;
isActive?: boolean;
isClickableWhenActive?: boolean;
};

const LaunchbarButton: FunctionComponent<LaunchbarButtonProps> = (
Expand All @@ -54,7 +55,7 @@ const LaunchbarButton: FunctionComponent<LaunchbarButtonProps> = (
/>
);

return isButtonEnabled && !isActive ? (
return (isButtonEnabled && !isActive) || props.isClickableWhenActive ? (
<NavLink
className={styles.launchbarButtonWrapperLink}
to={props.path}
Expand All @@ -68,7 +69,11 @@ const LaunchbarButton: FunctionComponent<LaunchbarButtonProps> = (
};

const LaunchbarButtonContent = memo(
(props: Required<Omit<LaunchbarButtonProps, 'path'>>) => {
(
props: Required<
Omit<LaunchbarButtonProps, 'path' | 'isClickableWhenActive'>
>
) => {
const [hoverRef, isHovered] = useHover<HTMLDivElement>();
const elementClasses = classNames(styles.launchbarButton, {
[styles.launchbarButtonSelected]: props.isActive,
Expand Down
1 change: 1 addition & 0 deletions src/header/launchbar/SpeciesSelectorLaunchbarButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const SpeciesSelectorLaunchbarButton = () => {
icon={SpeciesSelectorIcon}
enabled={true}
isActive={['species', 'species-selector'].includes(firstPathnamePart)}
isClickableWhenActive={true}
/>
);
};
Expand Down

0 comments on commit 9285608

Please sign in to comment.