button.tsx 681 B

12345678910111213141516171819202122
  1. import { useChatContext } from '@/app/components/base/chat/chat/context'
  2. import Button from '@/app/components/base/button'
  3. import cn from '@/utils/classnames'
  4. const MarkdownButton = ({ node }: any) => {
  5. const { onSend } = useChatContext()
  6. const variant = node.properties.dataVariant
  7. const message = node.properties.dataMessage
  8. const size = node.properties.dataSize
  9. return <Button
  10. variant={variant}
  11. size={size}
  12. className={cn('!h-8 !px-3 select-none')}
  13. onClick={() => onSend?.(message)}
  14. >
  15. <span className='text-[13px]'>{node.children[0]?.value || ''}</span>
  16. </Button>
  17. }
  18. MarkdownButton.displayName = 'MarkdownButton'
  19. export default MarkdownButton