-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '0.1.0' into menu-accessibility
- Loading branch information
Showing
12 changed files
with
809 additions
and
54 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<script> | ||
import Row from "./Row.svelte"; | ||
import Title from "./Title.svelte"; | ||
export let title = null; | ||
</script> | ||
|
||
<header class="w-full p-4 flex flex-col space-y-8 justify-center bg-long-city bg-cover border-b-2 border-gray-200"> | ||
<Row center> | ||
<a href="/"> | ||
<img src="/PVD_Things_Logo_White.png" alt="PVD Things" class="h-14 md:h-20 lg:h-24"/> | ||
</a> | ||
</Row> | ||
<Row center><slot /></Row> | ||
{#if title} | ||
<Row center><Title bold caps>{title}</Title></Row> | ||
{:else} | ||
<h1 hidden>PVD Things</h1> | ||
{/if} | ||
</header> |
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 |
---|---|---|
@@ -1,3 +1,19 @@ | ||
<h1 class="text-5xl md:text-6x text-white text-center"> | ||
<script> | ||
export let color = "white"; | ||
export let bold = false; | ||
export let caps = false; | ||
</script> | ||
|
||
<h1 class:bold class:caps class="text-3xl md:text-4xl text-{color} text-center max-w-max px-2 py-1 brutal bg-indigo-500 bg-opacity-75"> | ||
<slot /> | ||
</h1> | ||
</h1> | ||
|
||
<style> | ||
.bold { | ||
@apply font-bold; | ||
} | ||
.caps { | ||
@apply uppercase; | ||
} | ||
</style> |
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,84 @@ | ||
<script> | ||
import { onMount } from "svelte"; | ||
import shuffle from "../lib/shuffle"; | ||
import Header from "../components/Header.svelte"; | ||
import Subheading from "../components/Subheading.svelte"; | ||
import Container from "../components/Container.svelte"; | ||
import Scroller from "../components/Scroller.svelte"; | ||
import TextInput from "../components/TextInput.svelte"; | ||
let data; | ||
let searchResults = []; | ||
let searchText = ""; | ||
onMount(() => { | ||
let now = new Date(); | ||
let previousRefresh = new Date(sessionStorage.getItem("previousRefresh")); | ||
if (Math.abs(now - previousRefresh) > 120000) { | ||
thingify(); | ||
sessionStorage.setItem("previousRefresh", now.toUTCString()); | ||
} else { | ||
data = JSON.parse(sessionStorage.getItem("data")); | ||
data.things = shuffle(data.things); | ||
console.log('Previous data refreshed.'); | ||
} | ||
}); | ||
async function thingify() { | ||
const result = await fetch(`/.netlify/functions/things`); | ||
data = await result.json(); | ||
sessionStorage.setItem("data", JSON.stringify(data)) | ||
data.things = shuffle(data.things); | ||
console.log('Refreshed data from API.'); | ||
} | ||
function filterThings(category) { | ||
return data.things.filter(thing => thing.category === category); | ||
} | ||
function search() { | ||
if (searchText.length === 0) { | ||
searchResults = []; | ||
return; | ||
} | ||
const filtered = data.things.filter(thing => thing.name.toLowerCase().includes(searchText.toLowerCase())); | ||
if (filtered.length > 0) | ||
searchResults = filtered; | ||
} | ||
</script> | ||
|
||
<Header> | ||
<TextInput | ||
bind:value={searchText} | ||
on:input={search} | ||
placeholder="Search..." | ||
/> | ||
</Header> | ||
<div class="mt-10"> | ||
{#if !data} | ||
loading... | ||
{:else} | ||
{#if searchResults.length === 0} | ||
{#each data.categories as category} | ||
<div> | ||
<Container> | ||
<Subheading>{category}:</Subheading> | ||
</Container> | ||
<Scroller things={filterThings(category)} /> | ||
</div> | ||
{/each} | ||
{:else} | ||
<div> | ||
<Container> | ||
<Subheading>Things:</Subheading> | ||
</Container> | ||
<Scroller things={searchResults} /> | ||
</div> | ||
{/if} | ||
{/if} | ||
</div> |
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 was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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