-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
86 lines (84 loc) · 2.13 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import React from "react";
import Link from "gatsby-link";
import Helmet from "react-helmet";
import Main from "../components/main-page";
import PromoVideo from "../components/promo-video";
import Djs from "../components/djs";
export default class IndexPage extends React.Component {
render() {
console.log(this.props.data.allFile)
const files = this.props.data.allFile
const data = this.props.data.allMarkdownRemark.edges;
const logoData = this.props.data.file.childImageSharp;
const about = data.filter(
post => post.node.frontmatter.templateKey == "about-page"
)[0].node;
const djs = data.filter(
post => post.node.frontmatter.templateKey == "dj-profile"
);
const orderedDjs = djs.sort(function(a, b) {
return a.node.frontmatter.title
.toLowerCase()
.localeCompare(b.node.frontmatter.title.toLowerCase());
});
return (
<section className="bg-near-black">
<Main about={about} logoData={logoData} />
<Djs data={orderedDjs} files={files} />
</section>
);
}
}
export const frontPageQuery = graphql`
query frontPage {
allMarkdownRemark(sort: { order: DESC, fields: [frontmatter___title] }) {
edges {
node {
excerpt(pruneLength: 400)
html
id
frontmatter {
templateKey
path
title
fb
twitter
soundcloud
mail
instagram
mixcloud
promoPack
}
fields {
image {
childImageSharp {
original {
src
}
sizes(maxWidth: 500) {
...GatsbyImageSharpSizes
}
}
}
}
}
}
}
file(relativePath: { eq: "funkyfreshdj_white.png" }) {
childImageSharp {
sizes(maxWidth: 200) {
...GatsbyImageSharpSizes
}
}
}
allFile(filter: {extension: {eq: "zip"}}) {
edges {
node {
publicURL,
id
relativePath
}
}
}
}
`;