You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

tooltip.tsx 769B

123456789101112131415161718192021222324252627282930313233343536
  1. import * as _Tooltip from '@radix-ui/react-tooltip'
  2. import React from 'react'
  3. import styled from 'styles'
  4. export default function Tooltip({
  5. children,
  6. label,
  7. side = 'top',
  8. }: {
  9. children: React.ReactNode
  10. label: string
  11. side?: 'bottom' | 'left' | 'right' | 'top'
  12. }): JSX.Element {
  13. return (
  14. <_Tooltip.Root>
  15. <_Tooltip.Trigger as="span">{children}</_Tooltip.Trigger>
  16. <StyledContent side={side} sideOffset={8}>
  17. {label}
  18. <StyledArrow />
  19. </StyledContent>
  20. </_Tooltip.Root>
  21. )
  22. }
  23. const StyledContent = styled(_Tooltip.Content, {
  24. borderRadius: 3,
  25. padding: '6px 12px',
  26. fontSize: '$1',
  27. backgroundColor: '$text',
  28. color: '$panel',
  29. })
  30. const StyledArrow = styled(_Tooltip.Arrow, {
  31. fill: '$text',
  32. margin: '0 8px',
  33. })