Skip to content

Commit 155da19

Browse files
docs: docs tiered sponsors
1 parent 5a6e298 commit 155da19

File tree

6 files changed

+66
-12
lines changed

6 files changed

+66
-12
lines changed

docs/src/components/AdsContainer/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import './styles.css'
66

77
const AdsContainer = () => {
88
return (
9-
<div className="fixed">
10-
<BannerSponsor sponsorKey="frigade" />
11-
<BannerSponsor sponsorKey="dopt" />
9+
<div className="ads-container fixed">
10+
<BannerSponsor sponsorKey="frigade" tier="gold" />
1211
<AdsContainerElement />
12+
<BannerSponsor sponsorKey="dopt" tier="silver" />
1313
</div>
1414
)
1515
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
11
.fixed {
22
position: fixed;
33
}
4+
5+
.ads-container {
6+
display: flex;
7+
flex-direction: column;
8+
gap: 5px;
9+
10+
#carbonads {
11+
width: 100%;
12+
max-width: 341px;
13+
}
14+
}

docs/src/components/BannerSponsor/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ const SPONSORS = {
2828

2929
interface BannerSponsorProps {
3030
sponsorKey: keyof typeof SPONSORS
31+
tier: 'gold' | 'silver'
3132
}
3233

33-
const BannerSponsor = ({ sponsorKey }: BannerSponsorProps) => {
34+
const BannerSponsor = ({ sponsorKey, tier }: BannerSponsorProps) => {
3435
const sponsor = SPONSORS[sponsorKey]
3536

3637
const onClickSponsorBannerEventHandler = () => {
@@ -47,7 +48,7 @@ const BannerSponsor = ({ sponsorKey }: BannerSponsorProps) => {
4748
}
4849

4950
return (
50-
<div className="sponsor-banner">
51+
<div className={`sponsor-banner sponsor-banner-${tier}`}>
5152
<a
5253
href={`${sponsor.href}?source=react-tooltip`}
5354
title={sponsor.title}

docs/src/components/BannerSponsor/styles.css

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,17 @@
55
flex-direction: column;
66
min-inline-size: 130px;
77
max-inline-size: calc(130px + var(--sponsor-max-char) + 8ch);
8-
max-width: 377px;
8+
height: fit-content;
9+
10+
a {
11+
display: flex;
12+
}
913
}
14+
15+
.sponsor-banner-gold {
16+
max-width: 341px;
17+
}
18+
19+
.sponsor-banner-silver {
20+
max-width: 163px;
21+
}

docs/src/components/HomepageSponsored/index.tsx

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ type FeatureItem = {
1616
link: string
1717
}
1818

19+
type SponsorItem = FeatureItem & {
20+
tier: 'gold' | 'silver'
21+
}
22+
1923
const FeatureList: FeatureItem[] = [
2024
{
2125
title: 'Digital Ocean',
@@ -29,18 +33,20 @@ const FeatureList: FeatureItem[] = [
2933
},
3034
]
3135

32-
const SponsorList: FeatureItem[] = [
36+
const SponsorList: SponsorItem[] = [
3337
{
3438
title: 'Frigade',
3539
src: require('@site/static/img/sponsors/frigade.png').default,
3640
link: 'https://frigade.com/?source=react-tooltip',
3741
eventTitle: 'frigade',
42+
tier: 'gold',
3843
},
3944
{
4045
title: 'Dopt',
4146
src: require('@site/static/img/sponsors/dopt.png').default,
4247
link: 'https://dopt.com/?source=react-tooltip',
4348
eventTitle: 'dopt',
49+
tier: 'silver',
4450
},
4551
]
4652

@@ -70,14 +76,17 @@ export default function HomepageSponsored(): JSX.Element {
7076
return true
7177
}
7278

79+
const goldSponsors = SponsorList.filter(({ tier }) => tier === 'gold')
80+
const silverSponsors = SponsorList.filter(({ tier }) => tier === 'silver')
81+
7382
return (
7483
<section className={styles.features}>
7584
<div className="container">
76-
<h3 className={styles.sponsoredTitle}>Sponsored by</h3>
85+
<h1 className={styles.sponsoredTitle}>Gold Sponsors 🌟</h1>
7786
<div className="row">
78-
{SponsorList.map(({ link, title, src, eventTitle }, idx) => (
87+
{goldSponsors.map(({ link, title, src, eventTitle }, idx) => (
7988
// eslint-disable-next-line react/no-array-index-key
80-
<div key={idx} className={clsx(`col col--${12 / SponsorList.length}`)}>
89+
<div key={idx} className={clsx(`col col--${12 / goldSponsors.length}`)}>
8190
<div className="text--center">
8291
<a
8392
href={link}
@@ -94,9 +103,30 @@ export default function HomepageSponsored(): JSX.Element {
94103
</div>
95104
))}
96105
</div>
106+
<h2 className={styles.sponsoredTitle}>Silver Sponsors ✪</h2>
107+
<div className="row">
108+
{silverSponsors.map(({ link, title, src, eventTitle }, idx) => (
109+
// eslint-disable-next-line react/no-array-index-key
110+
<div key={idx} className={clsx(`col col--${12 / silverSponsors.length}`)}>
111+
<div className="text--center">
112+
<a
113+
href={link}
114+
title={title}
115+
target="_blank"
116+
rel="noreferrer"
117+
onClick={() => {
118+
onClickSponsorBannerEventHandler(eventTitle)
119+
}}
120+
>
121+
<img src={src} alt={title} width={200} />
122+
</a>
123+
</div>
124+
</div>
125+
))}
126+
</div>
97127
</div>
98128
<div className="container">
99-
<h3 className={styles.sponsoredTitle}>Powered by</h3>
129+
<h1 className={styles.sponsoredTitle}>Powered by</h1>
100130
<div className="row">
101131
{FeatureList.map((props, idx) => (
102132
// eslint-disable-next-line react/no-array-index-key

docs/src/components/HomepageSponsored/styles.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.features {
22
display: flex;
33
flex-direction: column;
4+
gap: 25px;
45
}
56

67
.featureSvg {
@@ -9,7 +10,6 @@
910
}
1011

1112
.sponsoredTitle {
12-
font-size: xx-large;
1313
display: flex;
1414
justify-content: center;
1515
}

0 commit comments

Comments
 (0)