Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tooltip not displaying on tap #412

Merged
merged 1 commit into from
Jan 27, 2022
Merged
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
12 changes: 11 additions & 1 deletion frontend/src/components/CategoryChip/CategoryChip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Tooltip from '@material-ui/core/Tooltip';
import InfoOutlinedIcon from '@material-ui/icons/InfoOutlined';
import clsx from 'clsx';
import { useTranslation } from 'next-i18next';
import { Fragment, useRef } from 'react';
import { Fragment, useRef, useState } from 'react';

import { Link } from '@/components/common/Link';
import { useSearchStore } from '@/store/search/context';
Expand Down Expand Up @@ -37,6 +37,8 @@ export function CategoryChip({
const [t] = useTranslation(['common', 'pluginData']);
const { searchStore } = useSearchStore();
const iconRef = useRef<HTMLButtonElement>(null);
const [open, setOpen] = useState(false);

const chipBody = category
? t(`pluginData:category.labels.${category}` as I18nKeys<'common'>)
: categoryHierarchy?.map((term, index) => (
Expand Down Expand Up @@ -85,6 +87,9 @@ export function CategoryChip({
{hasTooltip && (
<Tooltip
arrow
open={open}
onOpen={() => setOpen(true)}
onClose={() => setOpen(false)}
leaveDelay={0}
classes={{
arrow:
Expand Down Expand Up @@ -115,6 +120,11 @@ export function CategoryChip({
<button
className="p-2 pr-3 flex items-center justify-center"
ref={iconRef}
onClick={(event) => {
// Open tooltip when clicking on tooltip info button.
event.preventDefault();
setOpen(true);
}}
type="button"
>
<InfoOutlinedIcon className="w-3 h-3" />
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/PluginDetails/PluginDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function PluginCenterColumn() {
/>

{/* Plugin categories */}
<ul className="mt-5 text-xs flex flex-wrap gap-2">
<ul className="mt-5 text-xs flex flex-wrap gap-2 overflow-x-auto">
<SkeletonLoader
render={() =>
plugin?.category_hierarchy &&
Expand Down