refactor: team contact details

This commit is contained in:
2021-02-07 22:39:44 +00:00
parent 96f3bb7f3a
commit 0861995936
9 changed files with 183 additions and 141 deletions

View File

@@ -1,8 +1,25 @@
const { resolve } = require("path"); const { resolve } = require("path");
const reviews = require("./src/data/reviews.json"); const reviews = require("./src/data/reviews.json");
const caseStudies = require("./src/data/case-studies.json"); const caseStudies = require("./src/data/case-studies.json");
const team = require("./src/data/team.json");
exports.sourceNodes = ({ actions, createNodeId, createContentDigest }) => { exports.sourceNodes = ({ actions, createNodeId, createContentDigest }) => {
team.team.forEach(person => {
const { name, email, phone, altPhone, title } = person;
const node = {
name,
email,
phone,
altPhone,
title,
id: createNodeId(`team-${name.replace(/ /g, "-")}`),
internal: {
type: "person",
contentDigest: createContentDigest(person)
}
};
actions.createNode(node);
});
reviews.reviews.forEach((review, i) => { reviews.reviews.forEach((review, i) => {
const { name, title, text, author, date } = review; const { name, title, text, author, date } = review;
const node = { const node = {

View File

@@ -30,6 +30,10 @@ const Cell = styled.div`
`} `}
`; `;
const Item = styled.div`
margin-bottom: var(--spacing-y-sm);
`;
export default function Footer() { export default function Footer() {
const year = new Date().getFullYear(); const year = new Date().getFullYear();
return ( return (
@@ -37,6 +41,7 @@ export default function Footer() {
<Content> <Content>
<Grid columns={[1, 2]} breakpoints={["45em"]}> <Grid columns={[1, 2]} breakpoints={["45em"]}>
<Cell> <Cell>
<Item>
<IconWithContent> <IconWithContent>
<Icon color="dark" size="lg"> <Icon color="dark" size="lg">
<Phone /> <Phone />
@@ -51,6 +56,8 @@ export default function Footer() {
07539 051512 07539 051512
</Link> </Link>
</IconWithContent> </IconWithContent>
</Item>
<Item>
<IconWithContent> <IconWithContent>
<Icon color="dark" size="lg"> <Icon color="dark" size="lg">
<Phone /> <Phone />
@@ -65,8 +72,10 @@ export default function Footer() {
07378 839358 07378 839358
</Link> </Link>
</IconWithContent> </IconWithContent>
</Item>
</Cell> </Cell>
<Cell flexEnd={"45em"}> <Cell flexEnd={"45em"}>
<Item>
<IconWithContent> <IconWithContent>
<Icon color="dark" size="lg"> <Icon color="dark" size="lg">
<Envelope /> <Envelope />
@@ -81,6 +90,7 @@ export default function Footer() {
quotations@abcprojectdesign.com quotations@abcprojectdesign.com
</Link> </Link>
</IconWithContent> </IconWithContent>
</Item>
</Cell> </Cell>
</Grid> </Grid>
<Text size="xs">&copy; {year} Abc Project Ltd</Text> <Text size="xs">&copy; {year} Abc Project Ltd</Text>

View File

@@ -5,7 +5,6 @@ import { Icon } from "./";
const Container = styled.div` const Container = styled.div`
display: flex; display: flex;
align-items: center; align-items: center;
margin-bottom: var(--spacing-y-sm);
`; `;
const IconWrapper = styled.div` const IconWrapper = styled.div`

View File

@@ -3,7 +3,7 @@ import styled from "@emotion/styled";
import { css } from "@emotion/react"; import { css } from "@emotion/react";
const Container = styled.span` const Container = styled.span`
display: inline-block; display: inline-flex;
width: ${props => `var(--icon-size-${props.size})`}; width: ${props => `var(--icon-size-${props.size})`};
height: ${props => `var(--icon-size-${props.size})`}; height: ${props => `var(--icon-size-${props.size})`};
${props => ${props =>

View File

@@ -23,5 +23,6 @@ export { default as ReviewSummary } from "./review-summary";
export { default as Section } from "./section"; export { default as Section } from "./section";
export { default as Select } from "./select"; export { default as Select } from "./select";
export { default as Table } from "./table"; export { default as Table } from "./table";
export { default as Team } from './team';
export { default as Text } from "./text"; export { default as Text } from "./text";
export { default as Tile } from "./tile"; export { default as Tile } from "./tile";

66
src/components/team.js Normal file
View File

@@ -0,0 +1,66 @@
import React from "react";
import styled from "@emotion/styled";
import { Icon, IconWithContent, Link, Text } from ".";
import PhoneIcon from "../icons/phone.svg";
import EnvelopeIcon from "../icons/envelope.svg";
const Container = styled.ul`
padding: 0;
list-style: none;
`;
const Item = styled.li`
margin-bottom: var(--spacing-y-md);
`;
export default function Team({ team = [] }) {
return (
<Container>
{team.map((person, i) => (
<Item key={i}>
<div>
<Text size="sm" noMargin>
<strong>{person.name}</strong> &ndash; {person.title}
</Text>
</div>
<div>
{person.phone && (
<IconWithContent>
<Icon color="dark" size="sm">
<PhoneIcon />
</Icon>
<Link
weight="bold"
color="dark"
size="sm"
to={`tel:${person.phone
.replace(/ /g, "")
.replace(/^0/, "+44")}`}
noDecoration
>
{person.phone}
</Link>
</IconWithContent>
)}
{person.email && (
<IconWithContent>
<Icon color="dark" size="sm">
<EnvelopeIcon />
</Icon>
<Link
weight="bold"
color="dark"
size="sm"
to={`mailto:${person.email}`}
noDecoration
>
{person.email}
</Link>
</IconWithContent>
)}
</div>
</Item>
))}
</Container>
);
}

27
src/data/team.json Normal file
View File

@@ -0,0 +1,27 @@
{
"team": [
{
"name": "Nicholas Day",
"email": "quotations@abcprojectdesign.com",
"phone": "07539 051512",
"altPhone": "01708 938455",
"title": "Head of Sales and Marketing"
},
{
"name": "Daniel Costea",
"email": "daniel.costea@abcprojectdesign.com",
"phone": "07378 839358",
"title": "Project Director"
},
{
"name": "Maria Antonia",
"email": "maria.antonia@abcprojectdesign.com",
"title": "Design and Consultation Manager"
},
{
"name": "Harry Jackson",
"email": "harry.jackson@abcprojectdesign.com",
"title": "After Sales Manager"
}
]
}

View File

@@ -30,6 +30,7 @@ const GlobalStyles = css`
--font-size-lg: 1.125rem; // 18px --font-size-lg: 1.125rem; // 18px
--font-size-xl: 1.375rem; // 22px --font-size-xl: 1.375rem; // 22px
--font-size-xxl: 1.625rem; // 26px --font-size-xxl: 1.625rem; // 26px
--icon-size-sm: 12px;
--icon-size-md: 16px; --icon-size-md: 16px;
--icon-size-lg: 24px; --icon-size-lg: 24px;

View File

@@ -16,12 +16,13 @@ import {
Map, Map,
Section, Section,
Select, Select,
Team,
Text Text
} from "../components"; } from "../components";
import CheckCircle from "../icons/check-circle.svg"; import CheckCircleIcon from "../icons/check-circle.svg";
import Envelope from "../icons/envelope.svg"; import EnvelopeIcon from "../icons/envelope.svg";
import Phone from "../icons/phone.svg"; import PhoneIcon from "../icons/phone.svg";
import Team from "../icons/team.svg"; import TeamIcon from "../icons/team.svg";
const encode = data => { const encode = data => {
const formData = new FormData(); const formData = new FormData();
@@ -86,7 +87,7 @@ export default function Index({ data }) {
<> <>
<IconWithContent> <IconWithContent>
<Icon color="dark" size="lg"> <Icon color="dark" size="lg">
<CheckCircle /> <CheckCircleIcon />
</Icon> </Icon>
<Text color="dark" size="lg"> <Text color="dark" size="lg">
Thank you for contacting us! Thank you for contacting us!
@@ -102,7 +103,7 @@ export default function Index({ data }) {
{formState === "submitting" && <Interrupt />} {formState === "submitting" && <Interrupt />}
<IconWithContent> <IconWithContent>
<Icon color="dark" size="lg"> <Icon color="dark" size="lg">
<Envelope /> <EnvelopeIcon />
</Icon> </Icon>
<Text color="dark" size="lg"> <Text color="dark" size="lg">
Contact us Contact us
@@ -222,102 +223,13 @@ export default function Index({ data }) {
<div> <div>
<IconWithContent> <IconWithContent>
<Icon color="dark" size="lg"> <Icon color="dark" size="lg">
<Team /> <TeamIcon />
</Icon> </Icon>
<Text color="dark" size="lg"> <Text color="dark" size="lg">
The team The team
</Text> </Text>
</IconWithContent> </IconWithContent>
<ul> <Team team={data.allPerson.nodes} />
<li>
<Text>
<Link to="mailto:quotations@abcprojectdesign.com">
Nicholas Day
</Link>{" "}
&ndash; <em>Sales and Marketing Manager</em>
</Text>
</li>
<li>
<Text>
<Link to="mailto:daniel.costea@abcprojectdesign.com">
Daniel Costea
</Link>{" "}
&ndash; <em>Project Director</em>
</Text>
</li>
<li>
<Text>
<Link to="mailto:maria.antonia@abcprojectdesign.com">
Maria Antonia
</Link>{" "}
&ndash; <em>Design and Consultation Manager</em>
</Text>
</li>
<li>
<Text>
<Link to="mailto:harry.jackson@abcprojectdesign.com">
Harry Jackson
</Link>{" "}
&ndash; <em>After Sales Manager</em>
</Text>
</li>
</ul>
<IconWithContent>
<Icon color="dark" size="lg">
<Phone />
</Icon>
<Link
weight="bold"
color="dark"
size="lg"
to="tel:+447539051512"
noDecoration
>
07539 051512
</Link>
</IconWithContent>
<IconWithContent>
<Icon color="dark" size="lg">
<Phone />
</Icon>
<Link
weight="bold"
color="dark"
size="lg"
to="tel:+447378839358"
noDecoration
>
07378 839358
</Link>
</IconWithContent>
<IconWithContent>
<Icon color="dark" size="lg">
<Phone />
</Icon>
<Link
weight="bold"
color="dark"
size="lg"
to="tel:+441708938455"
noDecoration
>
01708 938455
</Link>
</IconWithContent>
<IconWithContent>
<Icon color="dark" size="lg">
<Envelope />
</Icon>
<Link
weight="bold"
color="dark"
size="md"
to="mailto:quotations@abcprojectdesign.com"
noDecoration
>
quotations@abcprojectdesign.com
</Link>
</IconWithContent>
</div> </div>
</Grid> </Grid>
</Section> </Section>
@@ -354,5 +266,14 @@ export const query = graphql`
} }
} }
} }
allPerson {
nodes {
name
email
phone
altPhone
title
}
}
} }
`; `;