AppCard.tsx 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import Image from "next/image"
  2. import { FormattedMessage } from "react-intl"
  3. export type AppCardProps = {
  4. name: React.ReactNode
  5. icon: string
  6. url: URL
  7. paid: boolean
  8. }
  9. /**
  10. * Renders a card with app data.
  11. * Layout (width, height, positioning) can be set from the parent.
  12. */
  13. export const AppCard = ({ name, icon, url, paid }) => {
  14. return (
  15. <a
  16. key={`${url} ${name}`}
  17. href={url}
  18. target="_blank"
  19. rel="noopener noreferrer"
  20. className="flex items-stretch justify-start gap-4 rounded border border-gray-3 bg-white p-2 hover:bg-gray-4 md:p-4"
  21. >
  22. <div className="h-[3.5rem] w-[3.5rem] flex-shrink-0 overflow-hidden rounded-sm">
  23. <Image src={icon} alt={`Logo for ${name}`} />
  24. </div>
  25. <div className="flex flex-auto flex-col">
  26. <span className="b4 block text-gray-1">
  27. {paid ? (
  28. <FormattedMessage id="apps.paid" defaultMessage="Paid" />
  29. ) : (
  30. <FormattedMessage id="apps.free" defaultMessage="Free" />
  31. )}
  32. </span>
  33. <h3 className="b1 !font-700 flex flex-auto items-center !leading-[1] rtl:text-right">
  34. <span dir="ltr">{name}</span>
  35. </h3>
  36. </div>
  37. </a>
  38. )
  39. }