-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathwebsite.js
74 lines (68 loc) · 1.72 KB
/
website.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
import React from "react"
import { graphql } from "gatsby"
import Repository from '../components/repository'
const Website = ({ data }) => {
const { kontentItemWebsite: website } = data;
return (
<div style={{ display: 'flex', flexDirection: 'column', justifyContent: "center", maxWidth: "960px", margin: "auto" }}>
<header>
<h1>{website.elements.name.value}</h1>
</header>
<section>
<p>{website.elements.summary.value}</p>
<a
href={website.elements.url.value}
style={{
padding: '.5em',
float: 'left',
border: '1px solid silver'
}}>
Enter website
</a>
</section>
{website.elements.source_repository.value.length > 0 && <section>
<h2>Source repository</h2>
<Repository item={website.elements.source_repository.value[0]} />
</section>}
</div>
);
}
export const query = graphql`
query WebsiteQuery($language: String!, $codename: String!) {
kontentItemWebsite(preferred_language: {eq: $language}, system: {codename: {eq: $codename}}) {
elements {
name {
value
}
summary {
value
}
url {
value
}
source_repository {
value {
... on kontent_item_repository {
__typename
elements {
name {
value
}
summary {
value
}
url {
value
}
slug {
value
}
}
}
}
}
}
}
}
`
export default Website