From a70dfd25ce8b73e735378c0d48d3f110a80723b6 Mon Sep 17 00:00:00 2001 From: Aarni Halinen Date: Tue, 30 Mar 2021 19:57:00 +0300 Subject: [PATCH] update contacts page styles --- src/components/CommitteeContainer.tsx | 60 -------------- src/components/ContactCard.tsx | 47 ++++++----- src/views/ContactsPage/ContactsPageView.tsx | 92 +++++++++++++-------- 3 files changed, 84 insertions(+), 115 deletions(-) delete mode 100644 src/components/CommitteeContainer.tsx diff --git a/src/components/CommitteeContainer.tsx b/src/components/CommitteeContainer.tsx deleted file mode 100644 index 850edd0..0000000 --- a/src/components/CommitteeContainer.tsx +++ /dev/null @@ -1,60 +0,0 @@ -import React from "react"; -import styled from "styled-components"; -import { Committee } from "@views/ContactsPage/ContactsPageView"; -import { colors } from "@theme/colors"; -import ContactCard from "./ContactCard"; - -const blank_profile = "/img/blank_profile.png"; - -interface CommitteeContainerProps { - committee: Committee; -} - -const Container = styled.div` - display: flex; - flex-direction: column; - align-items: center; - justify-content: flex-start; - color: ${colors.darkBlue}; - - & > p { - display: flex; - justify-content: center; - text-transform: uppercase; - letter-spacing: 3px; - line-height: 0.75; - font-weight: bold; - } - - & > div { - display: flex; - flex-flow: row wrap; - justify-content: center; - } -`; - -const CommitteeContainer: React.FC = ({ committee }) => ( - -

- {committee.name_fi || committee.name_en} -

-
- {committee.roles.map((role) => ( - role.representatives.map((representative) => ( - - )) - ))} -
-
-); - -export default CommitteeContainer; diff --git a/src/components/ContactCard.tsx b/src/components/ContactCard.tsx index a2a465f..5c92acb 100644 --- a/src/components/ContactCard.tsx +++ b/src/components/ContactCard.tsx @@ -5,17 +5,20 @@ import { colors } from "@theme/colors"; const Card = styled.article` display: flex; - align-items: flex-start; - flex-flow: row nowrap; + justify-content: space-between; + flex: 1 0 50%; padding: 0.5rem; color: ${colors.darkBlue}; - width: 19rem; +`; + +const Row = styled.div` + display: flex; + flex-flow: row nowrap; `; const ImageContainer = styled.div` position: relative; display: flex; - flex-shrink: 0; justify-content: center; align-items: center; height: 5rem; @@ -39,7 +42,7 @@ const Info = styled.div` margin: 0; } - & > h1 { + & > h3 { font-size: 0.9rem; font-weight: 500; } @@ -58,22 +61,24 @@ const ContactCard: React.FC = ({ name, phone, email, image, role_fi, role_en, }) => ( - {image ? ( - - {name} - - ) : null} - -

{name}

-

{role_fi || role_en}

- {phone ?

{phone}

: null} - {email ?

{email}

: null} -
+ + {image ? ( + + {name} + + ) : null} + +

{name}

+

{role_fi || role_en}

+ {phone ?

{phone}

: null} + {email ?

{email}

: null} +
+
); diff --git a/src/views/ContactsPage/ContactsPageView.tsx b/src/views/ContactsPage/ContactsPageView.tsx index 00235a8..770b178 100644 --- a/src/views/ContactsPage/ContactsPageView.tsx +++ b/src/views/ContactsPage/ContactsPageView.tsx @@ -1,8 +1,8 @@ import React from "react"; import styled from "styled-components"; -import CommitteeContainer from "@components/CommitteeContainer"; import { Divider, TextSection, Link } from "@components/index"; import { colors } from "@theme/colors"; +import ContactCard from "@components/ContactCard"; import BoardJson from "./board.json"; import HvtmkJson from "./hvtmk.json"; @@ -15,6 +15,8 @@ import TtmkJson from "./ttmk.json"; import UtmkJson from "./utmk.json"; import YtmkJson from "./ytmk.json"; +const blank_profile = "/img/blank_profile.png"; + const BlueLink = styled(Link)` color: ${colors.blue1}; @@ -23,19 +25,59 @@ const BlueLink = styled(Link)` } `; -export interface Committee { +const Container = styled.div` + color: ${colors.darkBlue}; + + & > h2 { + text-transform: uppercase; + width: 100%; + } + + & > div { + display: flex; + flex-flow: row wrap; + } +`; + +const CommitteeContainer: React.FC<{ + committee: Committee; +}> = ({ committee, children }) => ( + +

+ {committee.name_fi || committee.name_en} +

+
+ {committee.roles.map((role) => ( + role.representatives.map((representative) => ( + + )) + ))} +
+ {children} +
+); + +interface Committee { name_fi: string; name_en: string; roles: Array; } -export interface Role { +interface Role { name_fi: string; name_en: string; representatives: Array } -export interface Representative { +interface Representative { name: string; phone_number?: string; email?: string; @@ -45,6 +87,7 @@ export interface Representative { const ContactsPageView: React.FC = () => ( <> +

Yhteystiedot

Asiaa olisi, mutta kehen ottaa yhteyttä?
Tämä sivu yrittää valottaa sen oikean ihmisen puhelinnumeroa ja sähköpostiosoitetta. @@ -52,87 +95,68 @@ const ContactsPageView: React.FC = () => ( -

- +

{"Hallitukseen saa yhteyden lähettämällä sähköpostia "} hallitus@sahkoinsinoorikilta.fi

-
+
-
- -
+
-
- -
+
-
- -
+
-
- -
+
-
- -
+
-
- -
+
-
- -
+
-
- -
+
-
- -
+