refactored sponsor data into directory data

This commit is contained in:
Toni Ristola
2019-10-25 09:34:20 +03:00
committed by Aarni Koskela
parent 76424448ec
commit 125abe45d9
4 changed files with 31 additions and 19 deletions

View File

@@ -1,12 +1,12 @@
import React from "react";
import EmailComponent from "./EmailComponent";
const SponsorLink = ({ href, id, name }) => (
import sponsors from "../data/sponsors"
const SponsorLink = ({ href, name }) => (
<a href={href} target="_blank" rel="noopener noreferrer">
<img
src={`/static/images/sponsors/${id}.${id === "nordea" ? "png" : "svg"}`}
src={`/static/images/sponsors/${name}.${name === "Nordea" ? "png" : "svg"}`}
alt={name}
className={`sponsor sponsor__${id}`}
className={`sponsor sponsor__${name.toLowerCase()}`}
/>
</a>
);
@@ -16,19 +16,7 @@ export function Footer() {
<footer>
<div className="sponsors">
<div className="sponsors__label">Yhteistyössä</div>
<SponsorLink
id="futurice"
name="Futurice"
href="http://futurice.com/"
/>
<SponsorLink
id="metosin"
name="Metosin"
href="http://www.metosin.fi/"
/>
<SponsorLink id="solita" name="Solita" href="https://www.solita.fi/" />
<SponsorLink id="wakeone" name="Wakeone" href="http://wakeone.co/" />
<SponsorLink id="nordea" name="Nordea" href="https://www.nordea.com/" />
{sponsors.map(sponsor => <SponsorLink key={sponsor.id} {...sponsor} />)}
</div>
<div className="contacts">
<div>

View File

@@ -1,4 +1,4 @@
export const projects = [
const projects = [
{
title: "RE:DOM",
description:
@@ -25,3 +25,4 @@ export const projects = [
image: "/static/images/avain.svg",
},
];
export default projects;

23
data/sponsors.js Normal file
View File

@@ -0,0 +1,23 @@
const sponsors = [
{
name: "Futurice",
href: "http://futurice.com/",
},
{
name: "Metosin",
href: "http://www.metosin.fi/",
},
{
name: "Solita",
href: "https://www.solita.fi/",
},
{
name: "Wakeone",
href: "http://wakeone.co/",
},
{
name: "Nordea",
href: "https://www.nordea.fi/",
},
];
export default sponsors;

View File

@@ -5,7 +5,7 @@ import Head from "next/head";
import InviteForm from "../components/InviteForm";
import Members from "../components/Members";
import Feed from "../components/Feed";
import { projects } from "../data/indexData";
import projects from "../data/projects";
const Hero = () => (
<div className="header">