Skip to content

Commit

Permalink
Add toggle feature for sponsor links
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-kl1 committed Jan 30, 2025
1 parent 2672ed6 commit 080ce66
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
4 changes: 4 additions & 0 deletions public/locales/fr/sponsors.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"feature": {
"submitUrl": null,
"seeAllUrl": null
},
"data": [
{
"type": "platinum",
Expand Down
34 changes: 22 additions & 12 deletions src/components/SponsorList/SponsorList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ import Container from "@/layouts/Container";
import TopBanner from "@/components/TopBanner/TopBanner";
import React from "react";
import ButtonLink from "@/components/ButtonLink/ButtonLink";
import {useTranslation} from "react-i18next";

const SponsorList = ({ items }: { items: SponsorProps[] }) => {
const { t } = useTranslation(['sponsors']);
const features = t('features', { returnObjects: true });

const sponsorListByType: Record<SponsorTypeProps, SponsorProps[]> =
items.reduce(
(
Expand Down Expand Up @@ -44,19 +48,25 @@ const SponsorList = ({ items }: { items: SponsorProps[] }) => {
title="Merci à nos sponsors"
backgroundImage="/images/pattern_top-banner_sponsors.svg"
>
<ButtonLink variant="secondary" href="#sponsors">
Devenir sponsor
</ButtonLink>
<div className="hidden md:block">
<ButtonLink variant="soft-pink" href="#sponsors">
Voir tous les sponsors
</ButtonLink>
</div>
<div className="md:hidden">
<ButtonLink variant="soft-pink" href="#sponsors">
Voir tout
{'submitUrl' in features && typeof features.submitUrl === 'string' && (
<ButtonLink variant="secondary" href={features.submitUrl}>
Devenir sponsor
</ButtonLink>
</div>
)}
{'seeAllUrl' in features && typeof features.seeAllUrl === 'string' && (
<>
<div className="hidden md:block">
<ButtonLink variant="soft-pink" href={features.seeAllUrl}>
Voir tous les sponsors
</ButtonLink>
</div>
<div className="md:hidden">
<ButtonLink variant="soft-pink" href={features.seeAllUrl}>
Voir tout
</ButtonLink>
</div>
</>
)}
</TopBanner>
</div>
<ul
Expand Down

0 comments on commit 080ce66

Please sign in to comment.