-
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.
Adding the index pages, the query for the artists.json file, ArtistIt…
…em component
- Loading branch information
Showing
5 changed files
with
95 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<script> | ||
export let artist; | ||
</script> | ||
|
||
<style lang="scss"> | ||
h3 { | ||
text-align: center; | ||
} | ||
.image img { | ||
object-fit: cover; | ||
} | ||
.column { | ||
padding: 5rem; | ||
} | ||
</style> | ||
|
||
<a | ||
rel="prefetch" | ||
href="/artists/{artist.id}" | ||
class="column is-one-quarter-desktop is-one-third-tablet"> | ||
<div> | ||
<figure class="image is-square"> | ||
<img | ||
class="is-rounded" | ||
src={artist.imageUrls} | ||
alt="{artist.name} Picture" /> | ||
</figure> | ||
<h3>{artist.name}</h3> | ||
</div> | ||
</a> |
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,24 @@ | ||
import { fetchArtists } from '../../_directus'; | ||
|
||
|
||
export async function get(req, res, next) { | ||
const artists = await fetchArtists(); | ||
|
||
if (artists !== null) { | ||
res.setHeader('Content-Type', 'application/json'); | ||
res.end( | ||
JSON.stringify( | ||
artists.map(artist => ({ | ||
id: artist.id, | ||
name: artist.artist_name, | ||
imageUrls: artist.image ? artist.image.data.full_url : "placeholder_artists.jpeg", | ||
location: artist.current_location, | ||
category: artist.type_of_art | ||
})) | ||
) | ||
); | ||
} else { | ||
next(); | ||
} | ||
} | ||
|
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 |
---|---|---|
@@ -1 +1,28 @@ | ||
Artists | ||
<script context="module"> | ||
export function preload({ params, query }) { | ||
return this.fetch(`artists.json`) | ||
.then(r => r.json()) | ||
.then(artists => { | ||
return { artists }; | ||
}); | ||
} | ||
</script> | ||
|
||
<script> | ||
import ArtistItem from "../../components/UI/ArtistItem.svelte"; | ||
export let artists; | ||
</script> | ||
|
||
<style lang="scss"> | ||
</style> | ||
|
||
<svelte:head> | ||
<title>Artists</title> | ||
</svelte:head> | ||
|
||
<div class="columns is-multiline"> | ||
{#each artists as artist} | ||
<ArtistItem {artist} /> | ||
{/each} | ||
</div> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.