16 | {record.title}
17 | {record.artist ? (
18 |
19 |
20 | {record.artist.name}
21 |
22 |
23 | ) : (
24 | (Compilation album, various artists)
25 | )}
26 |
27 |
36 |
37 | {record.tracks.length ? (
38 |
39 | Tracklist
40 |
41 | ) : null}
42 | {record.tracks.map((track, i) => (
43 |
44 |
45 | {track.title}
46 | {` `}
47 | {new Date(1000 * track.aliasedLength).toISOString().substr(14, 5)}
48 |
49 |
50 | ))}
51 | {record.reviews.length ? (
52 |
59 | Reviews
60 |
61 | ) : null}
62 | {record.reviews.map((review, i) => (
63 |
69 |
70 | {review.title}
71 |
72 |
73 | ))}
74 |
75 |
76 |
77 | full-size, hi-res cover photo
78 |
79 |
80 |
81 |
88 | All Records
89 |
90 |
91 | );
92 | }
93 | }
94 |
95 | RecordDetailTemplate.propTypes = propTypes;
96 |
97 | export default RecordDetailTemplate;
98 |
99 | export const RecordDetailPageQuery = graphql`
100 | query getRecordById($id: String!) {
101 | record(id: { eq: $id }) {
102 | id
103 | slug
104 | title
105 | artist {
106 | id
107 | slug
108 | name
109 | }
110 | tracks {
111 | id
112 | title
113 | aliasedLength
114 | }
115 | cover {
116 | handle
117 | }
118 | reviews {
119 | id
120 | slug
121 | title
122 | }
123 | }
124 | }
125 | `;
126 |
--------------------------------------------------------------------------------
/src/templates/review-detail.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import * as PropTypes from "prop-types";
3 | import { graphql, Link } from "gatsby";
4 |
5 | import Layout from "../components/layout";
6 | import StarRatingComponent from "react-star-rating-component";
7 |
8 | const propTypes = {
9 | data: PropTypes.object.isRequired
10 | };
11 |
12 | class ReviewDetailTemplate extends React.Component {
13 | render() {
14 | const { review, reviewMarkdown } = this.props.data;
15 | return (
16 |