File size: 882 Bytes
4304c6d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
import { memo } from 'react'
import { PromptMenuItem } from './prompt-option'
type PromptMenuProps = {
startIndex: number
selectedIndex: number | null
options: any[]
onClick: (index: number, option: any) => void
onMouseEnter: (index: number, option: any) => void
}
const PromptMenu = ({
startIndex,
selectedIndex,
options,
onClick,
onMouseEnter,
}: PromptMenuProps) => {
return (
<div className='p-1'>
{
options.map((option, index: number) => (
<PromptMenuItem
startIndex={startIndex}
index={index}
isSelected={selectedIndex === index + startIndex}
onClick={onClick}
onMouseEnter={onMouseEnter}
key={option.key}
option={option}
/>
))
}
</div>
)
}
export default memo(PromptMenu)
|