update styling, count/highlight logic depending on params and post id

This commit is contained in:
Tom (plebeius.eth)
2024-06-29 11:55:36 +02:00
parent a6a41edd76
commit 6d07ea2e3c
9 changed files with 74 additions and 54 deletions
+11 -8
View File
@@ -5,9 +5,10 @@ import styles from './tooltip.module.css';
interface TooltipProps {
content: string;
children: ReactNode;
showTooltip?: boolean;
}
const Tooltip = ({ content, children }: TooltipProps) => {
const Tooltip = ({ content, children, showTooltip = true }: TooltipProps) => {
const [isOpen, setIsOpen] = useState(false);
const { refs, floatingStyles, context } = useFloating({
@@ -36,13 +37,15 @@ const Tooltip = ({ content, children }: TooltipProps) => {
<span ref={refs.setReference} {...getReferenceProps()}>
{children}
</span>
<FloatingPortal>
{isOpen && (
<div className={styles.tooltip} ref={refs.setFloating} style={floatingStyles} {...getFloatingProps()}>
{content}
</div>
)}
</FloatingPortal>
{showTooltip && (
<FloatingPortal>
{isOpen && (
<div className={styles.tooltip} ref={refs.setFloating} style={floatingStyles} {...getFloatingProps()}>
{content}
</div>
)}
</FloatingPortal>
)}
</>
);
};