Yet another refacto. I improved many many mechanisms on this one including dnd. It is now end 2 end tested 🎉
33 lines
727 B
TypeScript
33 lines
727 B
TypeScript
import { Item, ItemIndices, ItemType } from 'models'
|
|
import React from 'react'
|
|
import { ButtonNodeContent } from './contents/ButtonNodeContent'
|
|
import { ConditionNodeContent } from './contents/ConditionNodeContent'
|
|
|
|
type Props = {
|
|
item: Item
|
|
indices: ItemIndices
|
|
isMouseOver: boolean
|
|
isLastItem: boolean
|
|
}
|
|
|
|
export const ItemNodeContent = ({
|
|
item,
|
|
indices,
|
|
isMouseOver,
|
|
isLastItem,
|
|
}: Props) => {
|
|
switch (item.type) {
|
|
case ItemType.BUTTON:
|
|
return (
|
|
<ButtonNodeContent
|
|
item={item}
|
|
isMouseOver={isMouseOver}
|
|
indices={indices}
|
|
isLastItem={isLastItem}
|
|
/>
|
|
)
|
|
case ItemType.CONDITION:
|
|
return <ConditionNodeContent item={item} />
|
|
}
|
|
}
|