response.tsx 538 B

12345678910111213141516171819202122
  1. 'use client'
  2. import { cn } from '../../utils'
  3. import { type ComponentProps, memo } from 'react'
  4. import { Streamdown } from 'streamdown'
  5. type ResponseProps = ComponentProps<typeof Streamdown>
  6. export const Response = memo(
  7. ({ className, ...props }: ResponseProps) => (
  8. <Streamdown
  9. className={cn(
  10. 'size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0',
  11. className
  12. )}
  13. {...props}
  14. />
  15. ),
  16. (prevProps, nextProps) => prevProps.children === nextProps.children
  17. )
  18. Response.displayName = 'Response'