AppHero.tsx 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import Image, { ImageProps } from "next/legacy/image"
  2. import { FormattedMessage } from "react-intl"
  3. import downloadOnGooglePlay from "../public/badges/google-play.svg"
  4. import downloadOnAppStore from "../public/badges/app-store.svg"
  5. export type AppHeroProps = {
  6. /** Image source value passed to `next/image`'s `src` */
  7. backgroundImage: ImageProps["src"]
  8. /** Image-framing value passed to `next/image`'s `object-position` */
  9. backgroundImagePosition?: string
  10. }
  11. /** Renders a hero with links to the app store, typically at the bottom of a page. */
  12. export const AppHero = ({
  13. backgroundImage,
  14. backgroundImagePosition = "center center",
  15. }: AppHeroProps) => {
  16. return (
  17. <section className="full-width-bg relative -mb-footer-offset pb-footer-offset pt-32">
  18. <div className="absolute inset-0 -z-10">
  19. <Image
  20. src={backgroundImage}
  21. alt=""
  22. layout="fill"
  23. objectFit="cover"
  24. objectPosition={backgroundImagePosition}
  25. />
  26. </div>
  27. <div className="full-width-bg__inner flex flex-col gap-12 pb-[50vw] md:gap-20">
  28. <h2 className="h1 text-center">
  29. <FormattedMessage
  30. id="browse_apps.get_started"
  31. defaultMessage="Get started today"
  32. />
  33. </h2>
  34. <div className="grid-cols-12 justify-center gap-gutter md:grid">
  35. <div className="col-span-6 col-start-4 mx-auto grid max-w-xs grid-cols-2 justify-center gap-gutter md:mx-0 md:max-w-none md:justify-start xl:col-span-4 xl:col-start-5">
  36. <a href="https://apps.apple.com/us/app/mastodon-for-iphone/id1571998974">
  37. <Image
  38. src={downloadOnAppStore}
  39. layout="responsive"
  40. alt="Download on the App Store"
  41. />
  42. </a>
  43. <a href="https://play.google.com/store/apps/details?id=org.joinmastodon.android">
  44. <Image
  45. src={downloadOnGooglePlay}
  46. layout="responsive"
  47. alt="Get it on Google Play"
  48. />
  49. </a>
  50. </div>
  51. </div>
  52. </div>
  53. </section>
  54. )
  55. }
  56. export default AppHero