this repo has no description www.baileykane.co/
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Migrate from netlify CMS to google sheet for individual music item content

BK610 c2f7c4ac e1d15af1

+25 -18
+5 -5
components/MusicItem.js
··· 4 4 import SectionItemHeading from "./SectionItemHeading"; 5 5 6 6 export default class MusicItem extends Component { 7 - getContentBytype(type, embed_url) { 7 + getContentBytype(type, embedUrl) { 8 8 let content; 9 9 10 10 switch (type) { 11 11 case "YouTube": 12 12 content = ( 13 13 <iframe 14 - src={embed_url} 14 + src={embedUrl} 15 15 className="aspect-video h-full w-full" 16 16 allowFullScreen 17 17 /> ··· 40 40 divide-y divide-purple-300 dark:divide-purple-300" 41 41 > 42 42 <div className="group font-serif text-lg hover:underline"> 43 - {this.props.info.link_url ? ( 43 + {this.props.info.linkUrl ? ( 44 44 <a 45 - href={this.props.info.link_url} 45 + href={this.props.info.linkUrl} 46 46 target="_blank" 47 47 className="h-full w-full" 48 48 > ··· 85 85 > 86 86 {this.getContentBytype( 87 87 this.props.info.type, 88 - this.props.info.embed_url 88 + this.props.info.embedUrl 89 89 )} 90 90 </div> 91 91 </div>
+20 -13
pages/music.js
··· 3 3 import Head from "next/head"; 4 4 import MusicItem from "../components/MusicItem"; 5 5 import PageHeading from "../components/PageHeading"; 6 + import { getSheetsCSV, parseCSV } from "../lib/sheetsConnector"; 6 7 7 8 export default class Music extends Component { 8 9 static async getInitialProps() { ··· 24 25 <div className="w-full max-w-md space-y-4"> 25 26 <PageHeading>Music</PageHeading> 26 27 <div className="text-lg">Music I've been involved with</div> 27 - {musicList.map((music, k) => ( 28 - <MusicItem info={music.attributes} key={k} /> 28 + {musicList.data.map((musicItem, k) => ( 29 + <MusicItem info={musicItem} key={k} /> 29 30 ))} 30 31 </div> 31 32 </div> ··· 36 37 } 37 38 38 39 const importMusic = async () => { 39 - // From https://github.com/masives/netlifycms-nextjs/blob/master/pages/blog/index.js 40 - const markdownFiles = require 41 - .context("../content/music", false, /\.md$/) 42 - .keys() 43 - .map((relativePath) => relativePath.substring(2)); 44 - return Promise.all( 45 - markdownFiles.map(async (path) => { 46 - const markdown = await import(`../content/music/${path}`); 47 - return { ...markdown, slug: path.substring(0, path.length - 3) }; 48 - }) 49 - ); 40 + const musicCsv = await getSheetsCSV(process.env.NEXT_PUBLIC_MUSIC_DATA_URL); 41 + const musicJson = parseCSV(musicCsv); 42 + return musicJson; 50 43 }; 44 + 45 + // const importMusic = async () => { 46 + // // From https://github.com/masives/netlifycms-nextjs/blob/master/pages/blog/index.js 47 + // const markdownFiles = require 48 + // .context("../content/music", false, /\.md$/) 49 + // .keys() 50 + // .map((relativePath) => relativePath.substring(2)); 51 + // return Promise.all( 52 + // markdownFiles.map(async (path) => { 53 + // const markdown = await import(`../content/music/${path}`); 54 + // return { ...markdown, slug: path.substring(0, path.length - 3) }; 55 + // }) 56 + // ); 57 + // };