mirror of
https://github.com/langgenius/dify.git
synced 2025-07-14 20:49:56 +00:00
38 lines
845 B
TypeScript
38 lines
845 B
TypeScript
![]() |
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)
|