Files
web2.0-frontend/src/views/BoardPage/BoardPageView.tsx
T
2026-03-18 14:56:02 +02:00

151 lines
3.4 KiB
TypeScript

import React from "react";
import styled from "styled-components";
import { TextSection, Link } from "@components/index";
import colors from "@theme/colors";
import ContactCard from "@components/ContactCard";
import BoardJson from "./board.json";
const orderedCommittees = [
BoardJson,
];
const blankProfile = "/img/blank_profile.png";
const BlueLink = styled(Link)`
color: ${colors.blue1};
&:hover {
color: ${colors.lightBlue};
}
`;
const Container = styled.div`
color: ${colors.darkBlue};
align-items: center;
justify-content: center;
width: 50vw;
& > h2 {
text-transform: uppercase;
font-size: 4rem;
width: 100%;
}
& > div {
display: flex;
flex-flow: row wrap;
}
@media (max-width: 950px) {
width: 100vw;
}
`;
const BoardImage = styled.img`
width: 100%;
height: auto;
margin-bottom: 2rem;
border-radius: 8px;
`;
const ContactContainer = styled.div`
overflow-x: hidden;
@media (max-width: 950px) {
margin-top: 0;
}
`;
const CommitteeContainer: React.FC<{
committee: Committee;
children: React.ReactNode;
}> = ({ committee, children }) => (
<Container>
{committee.slug === "board" && (
<BoardImage
src="https://static.sahkoinsinoorikilta.fi/img/board/2026/Pota105_sikh26_webiin.jpg"
alt="Hallitus 2026"
/>
)}
<div>
{committee.roles.map((role) => (
role.representatives.map((representative) => (
<ContactCard
key={representative.name}
name={representative.name}
phone={representative.phone_number}
email={representative.email}
image={representative.image || blankProfile}
role_fi={role.name_fi}
role_en={role.name_en}
/>
))
))}
</div>
{children}
</Container>
);
interface Committee {
slug: string;
name_fi: string;
name_en: string;
roles: Array<Role>;
}
interface Role {
name_fi: string;
name_en: string;
representatives: Array<Representative>
}
interface Representative {
name: string;
phone_number?: string;
email?: string;
image?: string;
}
const BoardPageView: React.FC = () => (
<>
<TextSection>
<h1>Hallitus</h1>
<div>
<p>
Tältä sivulta löydät killan hallituksen jäsenten yhteystiedot.
</p>
<p>
{"Koko hallitukseen saa yhteyden lähettämällä sähköpostia osoitteeseen "}
<BlueLink to="mailto:hallitus@sahkoinsinoorikilta.fi">
hallitus@sahkoinsinoorikilta.fi
</BlueLink>
.
</p>
<p>
Muut yhteystiedot löydät <Link to="/yhteystiedot">täältä.</Link>
</p>
<p>
{"Hallitukselle voi myös lähettää palautetta täyttämällä "}
<BlueLink to="https://docs.google.com/forms/d/e/1FAIpQLSeD8Hm66uvwr7Xa2WGgOCfI2RS1NrZsmISf2QBKUcJf_stv8g/viewform?usp=sf_link">
palautelomakkeen
</BlueLink>
. Lomakkeen vastauksia käydään läpi hallituksen kokouksissa.
</p>
</div>
</TextSection>
<ContactContainer>
{orderedCommittees.map((json) => (
<React.Fragment key={json.slug}>
<TextSection id={json.slug}>
<CommitteeContainer committee={json}>
{(json.slug === "board")}
</CommitteeContainer>
</TextSection>
</React.Fragment>
))}
</ContactContainer>
</>
);
export default BoardPageView;