feedback-badge.tsx 532 B

12345678910111213141516171819202122232425
  1. import BetaBadge from './beta-badge'
  2. import { FC, ReactNode, useMemo } from 'react'
  3. export const FeedbackBadge: FC<{
  4. url: string
  5. id: string
  6. text?: ReactNode
  7. }> = ({ url, id, text }) => {
  8. const tooltip = useMemo(() => {
  9. return {
  10. id: `${id}-tooltip`,
  11. text: text || <DefaultContent />,
  12. }
  13. }, [id, text])
  14. return <BetaBadge tooltip={tooltip} phase="release" link={{ href: url }} />
  15. }
  16. const DefaultContent = () => (
  17. <>
  18. We are testing this new feature.
  19. <br />
  20. Click to give feedback
  21. </>
  22. )