feat: replace ? button with hint type icons in ActorPopover

This commit is contained in:
thibaud-leclere
2026-03-30 22:35:39 +02:00
parent 42a3567e1c
commit 91f45448f0
6 changed files with 27 additions and 5 deletions

View File

@@ -1,7 +1,13 @@
import React, { useState } from 'react';
import { useFloating, useClick, useDismiss, useInteractions, offset, flip, shift } from '@floating-ui/react';
export default function ActorPopover({ actorName }) {
const HINT_ICONS = {
film: 'fa-solid fa-film',
character: 'fa-solid fa-masks-theater',
award: 'fa-solid fa-trophy',
};
export default function ActorPopover({ hintType, hintText }) {
const [isOpen, setIsOpen] = useState(false);
const { refs, floatingStyles, context } = useFloating({
@@ -15,6 +21,8 @@ export default function ActorPopover({ actorName }) {
const dismiss = useDismiss(context);
const { getReferenceProps, getFloatingProps } = useInteractions([click, dismiss]);
const iconClass = HINT_ICONS[hintType] || 'fa-solid fa-circle-question';
return (
<>
<button
@@ -23,7 +31,7 @@ export default function ActorPopover({ actorName }) {
className="popover-trigger"
type="button"
>
?
<i className={iconClass}></i>
</button>
{isOpen && (
<div
@@ -32,7 +40,7 @@ export default function ActorPopover({ actorName }) {
{...getFloatingProps()}
className="actor-popover"
>
<strong>{actorName}</strong>
{hintText}
</div>
)}
</>