mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
update styling, count/highlight logic depending on params and post id
This commit is contained in:
@@ -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>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user