AppCard.tsx 1.3 KB

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