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