FEAT: NEW WORKFLOW ENGINE (#3160)
Co-authored-by: Joel <iamjoel007@gmail.com> Co-authored-by: Yeuoly <admin@srmxy.cn> Co-authored-by: JzoNg <jzongcode@gmail.com> Co-authored-by: StyleZhang <jasonapring2015@outlook.com> Co-authored-by: jyong <jyong@dify.ai> Co-authored-by: nite-knite <nkCoding@gmail.com> Co-authored-by: jyong <718720800@qq.com>
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
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)
|
Reference in New Issue
Block a user