Webseite mit Begleit-Infos zum Städte Quartett zur BTW 2021 https://www.gruenes-quartett.de
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

68 lines
1.8 KiB

import React, { ReactElement, useEffect, useState } from "react";
import "./Partners.scss";
import { url } from "../../variables";
import { Link } from "react-router-dom";
import ReactMarkdown from "react-markdown";
import PartnerLink from "../PartnerLink/PartnerLink";
import { useMatomo } from "@datapunt/matomo-tracker-react";
function Partners() {
const [{ title, content }, setContent] = useState({
title: "",
content: "",
});
const { trackPageView } = useMatomo();
const [partners, setPartners] = useState([]);
interface HomeProps {
title: string;
content: string;
}
interface PartnersProps {
id: number;
name: string;
url: string;
}
useEffect(() => {
const getContent = async (): Promise<HomeProps> => {
const response = await fetch(`${url}/partner-intro`);
const data = await response.json();
setContent(data);
return data;
};
const getPartners = async (): Promise<PartnersProps> => {
const response = await fetch(`${url}/partners`);
const data = await response.json();
setPartners(data);
return data;
};
getContent().then();
getPartners().then();
trackPageView({ documentTitle: "Beteiligte" });
}, [trackPageView]);
return (
<div className="Partners">
<h1 className="partners-title">{title}</h1>
<div className="partners-content">
<ReactMarkdown>{content}</ReactMarkdown>
</div>
<div className="partner-links">
{partners.map((t: PartnersProps): ReactElement => {
return <PartnerLink key={t.id} url={t.url} name={t.name} />;
})}
<Link to="/">
<button type="button" className="partners-button">
Zurück zur Startseite
</button>
</Link>
</div>
</div>
);
}
export default Partners;