From ff9385cd47d165dda8c25462420b8288d6844fd7 Mon Sep 17 00:00:00 2001 From: Aarni Halinen Date: Fri, 9 Oct 2020 00:13:45 +0300 Subject: [PATCH] FrontPage improvements and PageSection prop reducing --- src/components/Divider.tsx | 10 ++ src/components/PageSection/PageSection.tsx | 39 +++-- src/components/index.tsx | 8 + src/pages/FrontPage.tsx | 3 +- src/views/ContactsPage/ContactsPageView.tsx | 16 +- src/views/FrontPage/FrontPage.scss | 7 - src/views/FrontPage/FrontPageHero.tsx | 52 ++++++ src/views/FrontPage/FrontPageView.tsx | 180 +++++++------------- 8 files changed, 167 insertions(+), 148 deletions(-) create mode 100644 src/components/Divider.tsx create mode 100644 src/components/index.tsx delete mode 100644 src/views/FrontPage/FrontPage.scss create mode 100644 src/views/FrontPage/FrontPageHero.tsx diff --git a/src/components/Divider.tsx b/src/components/Divider.tsx new file mode 100644 index 0000000..797e3fc --- /dev/null +++ b/src/components/Divider.tsx @@ -0,0 +1,10 @@ +import styled from "styled-components"; +import { colors } from "@theme/colors"; + +const Divider = styled.hr` + width: 98%; + border-color: ${colors.blue1}; + margin: 0 auto; +`; + +export default Divider; diff --git a/src/components/PageSection/PageSection.tsx b/src/components/PageSection/PageSection.tsx index baa9b6c..771c9c3 100644 --- a/src/components/PageSection/PageSection.tsx +++ b/src/components/PageSection/PageSection.tsx @@ -1,22 +1,28 @@ import React from "react"; import styled from "styled-components"; -import ColorDiv, { ColorDivProps } from "../ColorDiv/ColorDiv"; -import { colors } from "@theme/colors"; +import { ColorDivProps } from "../ColorDiv/ColorDiv"; +import { ColorMapper } from "@theme/colors"; interface PageSectionProps { center?: boolean; - bottomBorder?: boolean; cardSection?: boolean; // does section contain a grid of cards fullSize?: boolean; } -const Section = styled(ColorDiv)` +const Section = styled.section` display: flex; flex-flow: row wrap; justify-content: ${(p) => p.center ? "center" : "space-between"}; position: relative; padding: ${(p) => p.fullSize ? 0 : "2rem 1rem 2rem"}; + color: ${(p) => p.textColor}; + background-color: ${(p) => p.backgroundColor}; + &:hover { + color: ${(p) => p.hoverColor}; + background-color: ${(p) => p.hoverBackgroundColor}; + } + .lander-hero { @media screen and (min-width: 800px) { min-height: 85vh; @@ -28,23 +34,16 @@ const Section = styled(ColorDiv)` flex-flow: column nowrap; } `} - - ${(p) => p.bottomBorder ? ` - &::after { - content: ""; - position: absolute; - bottom: 0; - width: 98%; - left: 1%; - border-bottom: 1px solid rgba(${colors.blue1}, 0.4); - } - ` : ""} `; -const PageSection: React.FC = (props) => { - return ( -
- ); -} +const PageSection: React.FC = ({ textColor, backgroundColor, hoverColor, backgroundHoverColor, ...props }) => ( +
+); export default PageSection; diff --git a/src/components/index.tsx b/src/components/index.tsx new file mode 100644 index 0000000..84aac83 --- /dev/null +++ b/src/components/index.tsx @@ -0,0 +1,8 @@ +export { default as Card } from "./Card"; +export { default as PageLink } from "./PageLink"; +export { default as Button } from "./Button"; +export { default as Ribbon } from "./Ribbon"; +export { default as SponsorReel } from "./SponsorReel"; +export { default as TextAnchor } from "./TextAnchor"; +export { default as PageSection } from "./PageSection"; +export { default as Divider } from "./Divider"; \ No newline at end of file diff --git a/src/pages/FrontPage.tsx b/src/pages/FrontPage.tsx index 9f1917b..b32225d 100644 --- a/src/pages/FrontPage.tsx +++ b/src/pages/FrontPage.tsx @@ -78,8 +78,7 @@ class FrontPage extends React.Component { const { events, feed } = this.state; return ( <> - - + ) diff --git a/src/views/ContactsPage/ContactsPageView.tsx b/src/views/ContactsPage/ContactsPageView.tsx index 2c530cc..6743ebc 100644 --- a/src/views/ContactsPage/ContactsPageView.tsx +++ b/src/views/ContactsPage/ContactsPageView.tsx @@ -4,12 +4,15 @@ import PageSection from "@components/PageSection"; import { Occupation, Committee } from "@models/Contacts"; import CommitteeContainer from "@components/CommitteeContainer"; import TextAnchor from "@components/TextAnchor"; +import { Divider } from "@components/index"; interface ContactsPageViewProps { contacts: Occupation[]; committees: Committee[]; } + + class ContactsPageView extends React.Component { render() { const { contacts, committees } = this.props; @@ -22,7 +25,8 @@ class ContactsPageView extends React.Component { Tämä sivu yrittää valottaa sen oikean ihmisen puhelinnumeroa ja sähköpostiosoitetta.

- + +

@@ -36,12 +40,16 @@ class ContactsPageView extends React.Component {

+ {committees.map((committee, index) => { const order = committee.name_fi === "Toimikunnattomat" ? 1 : 0; return ( - - x.role.committee.name_fi === committee.name_fi)} /> - + <> + + x.role.committee.name_fi === committee.name_fi)} /> + + + ) })} diff --git a/src/views/FrontPage/FrontPage.scss b/src/views/FrontPage/FrontPage.scss deleted file mode 100644 index bbedfd6..0000000 --- a/src/views/FrontPage/FrontPage.scss +++ /dev/null @@ -1,7 +0,0 @@ -@import "../../assets/scss/globals"; - -.front-page { - display: flex; - flex-flow: column wrap; - justify-content: flex-start; -} diff --git a/src/views/FrontPage/FrontPageHero.tsx b/src/views/FrontPage/FrontPageHero.tsx new file mode 100644 index 0000000..2970031 --- /dev/null +++ b/src/views/FrontPage/FrontPageHero.tsx @@ -0,0 +1,52 @@ +import React from "react"; +import { PageSection, Button } from "@components/index"; +import HeroMainSection from "@components/Hero/HeroMainSection"; +import HeroAsideSection from "@components/Hero/HeroAsideSection"; +import HeroAsideItem from "@components/Hero/HeroAsideItem"; + +const FrontPageHero: React.FC = () => ( + + +

Aalto-yliopiston Sähköinsinöörikilta

+

+ on elektroniikan ja sähkötekniikan opiskelijoiden järjestö. Kilta + kasaa yhteen yli 600 alansa huippua, jotka ovat avainasemassa + vauhdilla sähköistyvän maailmamme kehityksessä. +

+
+ + +
+
+ + + Fuksikasvatusta, ISO-toimintaa, lorem ipsum dolor sit ja amet. + + + Oletko abi, vaihtamassa uraa tai valmistumassa? + + + Avoimet työpaikat ja excursiot. Infoa yritysten edustajille ja + sponsseille. + + +
+); + +export default FrontPageHero; \ No newline at end of file diff --git a/src/views/FrontPage/FrontPageView.tsx b/src/views/FrontPage/FrontPageView.tsx index c0afdf6..60f08c4 100644 --- a/src/views/FrontPage/FrontPageView.tsx +++ b/src/views/FrontPage/FrontPageView.tsx @@ -1,131 +1,81 @@ import React from "react"; -import "./FrontPage.scss"; -import Card from "@components/Card"; +import { PageSection, Card, PageLink, Button, Ribbon, SponsorReel, TextAnchor, Divider } from "@components/index"; +import FrontPageHero from "./FrontPageHero"; import { Event } from "@models/Event"; import { Post } from "@models/Feed"; -import PageSection from "@components/PageSection"; - -import PageLink from "@components/PageLink/PageLink"; -import HeroMainSection from "@components/Hero/HeroMainSection"; -import HeroAsideSection from "@components/Hero/HeroAsideSection"; -import Button from "@components/Button"; -import Ribbon from "@components/Ribbon"; -import SponsorReel from "@components/SponsorReel"; -import HeroAsideItem from "@components/Hero/HeroAsideItem"; -import TextAnchor from "@components/TextAnchor"; - interface FrontPageViewProps { events: Event[]; feed: Post[]; } const FrontPageView: React.FC = ({ events, feed }) => ( -
- - -

Aalto-yliopiston Sähköinsinöörikilta

-

- on elektroniikan ja sähkötekniikan opiskelijoiden järjestö. Kilta - kasaa yhteen yli 600 alansa huippua, jotka ovat avainasemassa - vauhdilla sähköistyvän maailmamme kehityksessä. -

-
- - -
-
- - - Fuksikasvatusta, ISO-toimintaa, lorem ipsum dolor sit ja amet. - - - Oletko abi, vaihtamassa uraa tai valmistumassa? - - - Avoimet työpaikat ja excursiot. Infoa yritysten edustajille ja - sponsseille. - - -
- - {events.map(event => ( - { }}> -
Lue lisää ›
- - } - /> - ))} -
- + <> + +
+ + {events.map(event => ( + { }}> +
Lue lisää ›
+ + } + /> + ))} +
+ Kaikki tapahtumat - -
-
- - -

Sössöä vuodesta 1969.

- -

Lue opiskelijalehden viimeisin numero ›

-
-
-
- - {feed.map(inst => ( - { }}> -
Lue lisää ›
- - } - /> - ))} -
- + +
+
+ + +

Sössöä vuodesta 1969.

+ +

Lue opiskelijalehden viimeisin numero ›

+
+
+
+ + {feed.map(inst => ( + { }}> +
Lue lisää ›
+ + } + /> + ))} +
+ Lue tuoreimmat uutiset - - + + Kuvia tapahtumista - -
-
- - - -
+ +
+
+ + + + + + ) export default FrontPageView;