1
|
|
|
import { graphql } from "gatsby" |
2
|
|
|
import { GatsbyImage, getSrc, StaticImage } from "gatsby-plugin-image" |
3
|
|
|
import React from "react" |
4
|
|
|
import { Seo } from "../components/Seo" |
5
|
|
|
import Layout from "../layouts" |
6
|
|
|
import { TeamQuery } from "../Types/Team" |
7
|
|
|
import ReactFitText from "@kennethormandy/react-fittext" |
8
|
|
|
|
9
|
|
|
const Team = ({ data: { nodeTeam } }: TeamQuery) => { |
10
|
|
|
const heroImage = nodeTeam?.relationships?.field_media_article_image |
11
|
|
|
const teamPicture = heroImage?.relationships?.field_media_image?.localFile?.childImageSharp?.gatsbyImageData && ( |
12
|
|
|
<GatsbyImage |
13
|
|
|
image={heroImage.relationships?.field_media_image?.localFile?.childImageSharp?.gatsbyImageData} |
14
|
|
|
alt={heroImage?.field_media_image?.alt || ``} |
15
|
|
|
className={`team-detail__team-picture`} |
16
|
|
|
/> |
17
|
|
|
) |
18
|
|
|
|
19
|
|
|
// Helper variable so we don't have to do the check over and over again. |
20
|
|
|
const hasDivision = nodeTeam?.field_fb_id || nodeTeam?.field_fb_id_2 || nodeTeam?.field_vv_id |
21
|
|
|
const articles = nodeTeam?.relationships?.node__article || [] |
22
|
|
|
|
23
|
|
|
return ( |
24
|
|
|
<Layout> |
25
|
|
|
<header className="page_header__wrapper"> |
26
|
|
|
<div className="page_header"> |
27
|
|
|
<h1 className={`team-detail__name`}> |
28
|
|
|
{/* > GEWESTELIJKE U13 K */} |
29
|
|
|
<span className={`team-detail__name-division`}> |
30
|
|
|
<ReactFitText compressor={1.5}>{nodeTeam?.field_division_full}</ReactFitText> |
31
|
|
|
</span> |
32
|
|
|
{/* > The A-team */} |
33
|
|
|
<span className={`team-detail__name-tagline`}>{nodeTeam?.field_tagline}</span> |
34
|
|
|
</h1> |
35
|
|
|
{hasDivision && ( |
36
|
|
|
<div className={`team-detail__division-number`} aria-hidden="true"> |
37
|
|
|
{nodeTeam?.field_fb_id_2 ? nodeTeam?.field_fb_id_2 : nodeTeam?.field_fb_id} |
38
|
|
|
</div> |
39
|
|
|
)} |
40
|
|
|
NAV LINKS RECHTS RANKING LINEUP |
41
|
|
|
</div> |
42
|
|
|
</header> |
43
|
|
|
<div className="page__header__image__wrapper"> |
44
|
|
|
<div className="page__header__image__bg">{teamPicture}</div> |
45
|
|
|
<div className="page__header__image__hero">{teamPicture}</div> |
46
|
|
|
</div> |
47
|
|
|
<article className="page__wrapper team__wrapper"></article> |
48
|
|
|
</Layout> |
49
|
|
|
) |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
export default Team |
53
|
|
|
|
54
|
|
|
export const Head = ({ data: { nodeTeam } }: TeamQuery) => { |
55
|
|
|
const pathUrl = nodeTeam?.path?.alias || `` |
56
|
|
|
const heroImage = |
57
|
|
|
nodeTeam?.relationships?.image_og?.relationships?.field_media_image?.localFile?.childImageSharp?.gatsbyImageData |
58
|
|
|
|
59
|
|
|
const ogImage = heroImage && { |
60
|
|
|
src: getSrc(heroImage) || ``, |
61
|
|
|
width: heroImage.width, |
62
|
|
|
height: heroImage.height, |
63
|
|
|
} |
64
|
|
|
return <Seo title={`${nodeTeam?.title} / ${nodeTeam?.field_division_full}`} path={pathUrl} image={ogImage} /> |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
export const query = graphql` |
68
|
|
|
query TeamQuery($slug: String!) { |
69
|
|
|
nodeTeam(path: { alias: { eq: $slug } }) { |
70
|
|
|
path { |
71
|
|
|
alias |
72
|
|
|
} |
73
|
|
|
title |
74
|
|
|
field_contact_info { |
75
|
|
|
processed |
76
|
|
|
} |
77
|
|
|
field_fb_id |
78
|
|
|
field_fb_id_2 |
79
|
|
|
field_vv_id |
80
|
|
|
field_division_full |
81
|
|
|
field_tagline |
82
|
|
|
relationships { |
83
|
|
|
field_staff { |
84
|
|
|
path { |
85
|
|
|
alias |
86
|
|
|
} |
87
|
|
|
field_position_short |
88
|
|
|
field_lastname |
89
|
|
|
field_firstname |
90
|
|
|
relationships { |
91
|
|
|
field_image { |
92
|
|
|
localFile { |
93
|
|
|
...KCVVFluidPlayerTeaser |
94
|
|
|
} |
95
|
|
|
} |
96
|
|
|
} |
97
|
|
|
} |
98
|
|
|
field_players { |
99
|
|
|
path { |
100
|
|
|
alias |
101
|
|
|
} |
102
|
|
|
field_shirtnumber |
103
|
|
|
field_lastname |
104
|
|
|
field_firstname |
105
|
|
|
field_position |
106
|
|
|
relationships { |
107
|
|
|
field_image { |
108
|
|
|
localFile { |
109
|
|
|
...KCVVFluidPlayerTeaser |
110
|
|
|
} |
111
|
|
|
} |
112
|
|
|
} |
113
|
|
|
} |
114
|
|
|
field_media_article_image { |
115
|
|
|
...FullImage |
116
|
|
|
field_media_image { |
117
|
|
|
alt |
118
|
|
|
} |
119
|
|
|
} |
120
|
|
|
image_og: field_media_article_image { |
121
|
|
|
...ArticleImage |
122
|
|
|
} |
123
|
|
|
node__article { |
124
|
|
|
title |
125
|
|
|
timestamp: created(formatString: "x") |
126
|
|
|
path { |
127
|
|
|
alias |
128
|
|
|
} |
129
|
|
|
relationships { |
130
|
|
|
field_media_article_image { |
131
|
|
|
...ArticleImage |
132
|
|
|
} |
133
|
|
|
} |
134
|
|
|
} |
135
|
|
|
} |
136
|
|
|
} |
137
|
|
|
} |
138
|
|
|
` |
139
|
|
|
|