mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-19 23:31:21 +02:00
Fix indent guide hovering
This commit is contained in:
@@ -1,16 +1,19 @@
|
||||
import classNames from 'classnames';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { memo } from 'react';
|
||||
import { hoveredParentDepthFamily } from './atoms';
|
||||
import { hoveredParentDepthFamily, isParentHoveredFamily } from './atoms';
|
||||
|
||||
export const TreeIndentGuide = memo(function TreeIndentGuide({
|
||||
treeId,
|
||||
depth,
|
||||
parentId,
|
||||
}: {
|
||||
treeId: string;
|
||||
depth: number;
|
||||
parentId: string | null;
|
||||
}) {
|
||||
const parentDepth = useAtomValue(hoveredParentDepthFamily(treeId));
|
||||
const isHovered = useAtomValue(isParentHoveredFamily({ treeId, parentId }));
|
||||
|
||||
return (
|
||||
<div className="flex">
|
||||
@@ -19,7 +22,7 @@ export const TreeIndentGuide = memo(function TreeIndentGuide({
|
||||
key={i}
|
||||
className={classNames(
|
||||
'w-[1rem] border-r border-r-text-subtlest',
|
||||
parentDepth !== i + 1 && 'opacity-30',
|
||||
!(parentDepth === i + 1 && isHovered) && 'opacity-30',
|
||||
)}
|
||||
/>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user