Passed
Pull Request — develop (#758)
by Kevin Van
08:39 queued 04:54
created

src/pages/jeugd.tsx   A

Complexity

Total Complexity 19
Complexity/F 0

Size

Lines of Code 108
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 19
eloc 72
mnd 19
bc 19
fnc 0
dl 0
loc 108
rs 10
bpm 0
cpm 0
noi 0
c 0
b 0
f 0
1
import { graphql, Link } from "gatsby"
2
import { GatsbyImage, StaticImage } from "gatsby-plugin-image"
3
import React from "react"
4
import { CardHorizontal } from "../components/Card"
5
import { MatchesOverview } from "../components/MatchesOverview"
6
import { Seo } from "../components/Seo"
7
import Layout from "../layouts"
8
import { JeugdPageProps } from "../Types/PageProps"
9
import "./jeugd.scss"
10
11
const JeugdPage = ({ data: { leerplan, allNodeTeam } }: JeugdPageProps) => {
12
  return (
13
    <Layout>
14
      <header className="page_header__wrapper">
15
        <div className="page_header">
16
          <h1>Jeugdwerking KCVV Elewijt</h1>
17
        </div>
18
      </header>
19
      <div className="page__wrapper page__wrapper--limited page__section page__youth">
20
        <h2 className="featured-border">Jeugdploegen</h2>
21
        <section className="youth__teams_list">
22
          {allNodeTeam.edges.map(({ node }) => {
23
            const heroImage = node?.relationships?.field_media_article_image
24
            const teamPicture = heroImage?.relationships?.field_media_image?.localFile?.childImageSharp
25
              ?.gatsbyImageData && (
26
              <GatsbyImage
27
                image={heroImage.relationships?.field_media_image?.localFile?.childImageSharp?.gatsbyImageData}
28
                alt={heroImage?.field_media_image?.alt || ``}
29
                className={`team-detail__team-picture`}
30
                objectFit="cover"
31
              />
32
            )
33
            return (
34
              <div className="youth__teams_list__item">
35
                <h3 className="after-border">{node.title}</h3>
36
                <Link to={node?.path?.alias || ``}>
37
                  {teamPicture || (
38
                    <StaticImage
39
                      layout="fullWidth"
40
                      src={`../images/empty-lineup.jpg`}
41
                      alt={`${node.title}`}
42
                      placeholder={`tracedSVG`}
43
                      objectFit="cover"
44
                      aspectRatio={1.777777777}
45
                      transformOptions={{ cropFocus: `attention` }}
46
                    />
47
                  )}
48
                </Link>
49
              </div>
50
            )
51
          })}
52
        </section>
53
54
        {leerplan?.childImageSharp?.gatsbyImageData && (
55
          <>
56
            <h2 className="featured-border">Meer info</h2>
57
            <section>
58
              <CardHorizontal
59
                title="Leerplannen voor de jeugdwerking"
60
                picture={leerplan?.childImageSharp?.gatsbyImageData}
61
                link="/news/2019-08-08-leerplan-kcvv-elewijt-jeugd"
62
                body="Het jeugdbestuur legt aan de hand van dit document uit waar onze jeugdwerking voor staat en hoe de aanpak zal verlopen."
63
              />
64
            </section>
65
          </>
66
        )}
67
        <section>
68
          <h2 className="featured-border">Volgende wedstrijden</h2>
69
          <MatchesOverview exclude={[`1`, `2`]} />
70
        </section>
71
      </div>
72
    </Layout>
73
  )
74
}
75
76
export const Head = () => {
77
  return <Seo title="Jeugdwerking" description="Jeugdwerking van KCVV Elewijt" path="/jeugd/" />
78
}
79
80
export const pageQuery = graphql`
81
  query JeugdPage {
82
    leerplan: file(name: { eq: "leerplan_header" }) {
83
      ...KCVVFullWidth
84
    }
85
    allNodeTeam(filter: { field_vv_id: { ne: null, nin: ["1", "2"] } }, sort: { fields: field_fb_id_2 }) {
86
      edges {
87
        node {
88
          path {
89
            alias
90
          }
91
          field_vv_id
92
          title
93
          relationships {
94
            field_media_article_image {
95
              ...FullImage
96
              field_media_image {
97
                alt
98
              }
99
            }
100
          }
101
        }
102
      }
103
    }
104
  }
105
`
106
107
export default JeugdPage
108