-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
17ad34b
commit 8ea88fc
Showing
7 changed files
with
111 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// TODO should use src or public? depends on dev vs production mode? | ||
import { handler as page } from '../../public/artists-manual.js'; | ||
|
||
export async function handler (event, context) { | ||
const { rawUrl, headers } = event; | ||
const request = new Request(rawUrl, { headers }); | ||
const response = await page(request); | ||
|
||
// TODO need to handle all Response properties like headers | ||
return { | ||
statusCode: response.status, | ||
body: await response.text() | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// TODO should use src or public? depends on dev vs production mode? | ||
import { handler as page } from '../../public/artists.js'; | ||
|
||
export async function handler (event, context) { | ||
const { rawUrl, headers } = event; | ||
const request = new Request(rawUrl, { headers }); | ||
const response = await page(request); | ||
|
||
// TODO need to handle all Response properties like headers | ||
return { | ||
statusCode: response.status, | ||
body: await response.text() | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import Card from '../components/card.manual.js'; | ||
|
||
export default class ArtistsPage extends HTMLElement { | ||
async connectedCallback() { | ||
const artists = await fetch('https://www.analogstudios.net/api/artists').then(resp => resp.json()); | ||
const card = new Card(); | ||
|
||
await card.connectedCallback(); | ||
|
||
const html = artists.map((artist) => { | ||
const { name, imageUrl } = artist; | ||
return ` | ||
<app-card-manual> | ||
${card.getInnerHTML({ includeShadowRoots: true })} | ||
<h2 slot="title">${name}</h2> | ||
<img slot="thumbnail" src="${imageUrl}" alt="${name}"/> | ||
</app-card-manual> | ||
`; | ||
}).join(''); | ||
|
||
this.innerHTML = ` | ||
<h1>List of Artists: ${artists.length}</h1> | ||
${html} | ||
`; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import '../components/card.js'; | ||
|
||
export default class ArtistsPage extends HTMLElement { | ||
async connectedCallback() { | ||
const artists = await fetch('https://www.analogstudios.net/api/artists').then(resp => resp.json()); | ||
const html = artists.map(artist => { | ||
const { name, imageUrl } = artist; | ||
|
||
return ` | ||
<app-card | ||
title="${name}" | ||
thumbnail="${imageUrl}" | ||
> | ||
</app-card> | ||
`; | ||
}).join(''); | ||
|
||
this.innerHTML = ` | ||
<h1>List of Artists: ${artists.length}</h1> | ||
${html} | ||
`; | ||
} | ||
} |
File renamed without changes.