refactor(variable-list): simplify variable list rendering and adjust drag handle position

Remove unnecessary mapping of list items with IDs and use direct variable references. Adjust drag handle position for better visual alignment.
pull/22127/head
Mminamiyama 11 months ago
parent b634e1b57d
commit 3e150f45ca

@ -128,15 +128,14 @@ const VarList: FC<Props> = ({
ghostClass='opacity-50' ghostClass='opacity-50'
animation={150} animation={150}
> >
{listWithIds.map((item, index) => { {list.map((variable, index) => {
const canDrag = (() => { const canDrag = (() => {
if (readonly) if (readonly)
return false return false
return varCount > 1 return varCount > 1
})() })()
const variable = item.variable
return ( return (
<div className={cn('flex items-center space-x-1', 'group relative')} key={item.id || index}> <div className={cn('flex items-center space-x-1', 'group relative')} key={index}>
<Input <Input
wrapperClassName='w-[120px]' wrapperClassName='w-[120px]'
disabled={readonly} disabled={readonly}
@ -161,7 +160,7 @@ const VarList: FC<Props> = ({
<RemoveButton onClick={handleVarRemove(index)}/> <RemoveButton onClick={handleVarRemove(index)}/>
)} )}
{canDrag && <RiDraggable className={cn( {canDrag && <RiDraggable className={cn(
'handle absolute -left-4 top-3 hidden h-3 w-3 cursor-pointer text-text-quaternary', 'handle absolute -left-4 top-2.5 hidden h-3 w-3 cursor-pointer text-text-quaternary',
'group-hover:block', 'group-hover:block',
)} />} )} />}
</div> </div>

Loading…
Cancel
Save