Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

suggested-action.tsx 1.1KB

1234567891011121314151617181920212223242526272829
  1. import type { HTMLProps, PropsWithChildren } from 'react'
  2. import { RiArrowRightUpLine } from '@remixicon/react'
  3. import classNames from '@/utils/classnames'
  4. export type SuggestedActionProps = PropsWithChildren<HTMLProps<HTMLAnchorElement> & {
  5. icon?: React.ReactNode
  6. link?: string
  7. disabled?: boolean
  8. }>
  9. const SuggestedAction = ({ icon, link, disabled, children, className, ...props }: SuggestedActionProps) => (
  10. <a
  11. href={disabled ? undefined : link}
  12. target='_blank'
  13. rel='noreferrer'
  14. className={classNames(
  15. 'flex justify-start items-center gap-2 py-2 px-2.5 bg-background-section-burn rounded-lg text-text-secondary transition-colors [&:not(:first-child)]:mt-1',
  16. disabled ? 'shadow-xs opacity-30 cursor-not-allowed' : 'hover:bg-state-accent-hover hover:text-text-accent cursor-pointer',
  17. className,
  18. )}
  19. {...props}
  20. >
  21. <div className='relative h-4 w-4'>{icon}</div>
  22. <div className='system-sm-medium shrink grow basis-0'>{children}</div>
  23. <RiArrowRightUpLine className='h-3.5 w-3.5' />
  24. </a>
  25. )
  26. export default SuggestedAction