Skip to content

Commit

Permalink
Fix toggle actions
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-kl1 committed Jan 30, 2025
1 parent 080ce66 commit d000c0b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 17 deletions.
3 changes: 3 additions & 0 deletions public/locales/fr/speakers.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"actions": {
"seeAllUrl": null
},
"data": {
"title": "Appel à speakers",
"subtitle": "Vous êtes expert du E-Commerce ou passionné de Magento ?",
Expand Down
2 changes: 1 addition & 1 deletion public/locales/fr/sponsors.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"feature": {
"actions": {
"submitUrl": null,
"seeAllUrl": null
},
Expand Down
27 changes: 17 additions & 10 deletions src/components/Speakers/SpeakersList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ import Speaker from "./Speaker/Speaker";
import SpeakerPopIn from "./Speaker/SpeakerPopIn";
import ButtonLink from "@/components/ButtonLink/ButtonLink";
import { SpeakerProps } from "@/components/Speakers/Speaker/SpeakerProps";
import {useTranslation} from "react-i18next";

const SpeakersList = ({ speakers }: { speakers: SpeakerProps[] }) => {
const { width } = useWindowSize();
const swiperRef = React.useRef<SwiperClass>(null);
const [selectedSpeaker, setSelectedSpeaker] =
React.useState<SpeakerProps | null>(null);
const { t } = useTranslation(['speakers']);
const actions = t('actions', { returnObjects: true });

const handleSpeakerClick = (speaker: SpeakerProps) => {
setSelectedSpeaker(speaker);
Expand Down Expand Up @@ -48,16 +51,20 @@ const SpeakersList = ({ speakers }: { speakers: SpeakerProps[] }) => {
onPrevClick={handlePrev}
onNextClick={handleNext}
>
<div className="md:hidden">
<ButtonLink variant="secondary" href="#speakers">
Voir tout
</ButtonLink>
</div>
<div className="hidden md:block">
<ButtonLink variant="secondary" href="#speakers">
Découvrir les speakers
</ButtonLink>
</div>
{'seeAllUrl' in actions && typeof actions.seeAllUrl === 'string' && (
<>
<div className="md:hidden">
<ButtonLink variant="secondary" href={actions.seeAllUrl}>
Voir tout
</ButtonLink>
</div>
<div className="hidden md:block">
<ButtonLink variant="secondary" href={actions.seeAllUrl}>
Découvrir les speakers
</ButtonLink>
</div>
</>
)}
</TopBanner>
</div>
<ClientOnly>
Expand Down
12 changes: 6 additions & 6 deletions src/components/SponsorList/SponsorList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {useTranslation} from "react-i18next";

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

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

0 comments on commit d000c0b

Please sign in to comment.