From 3a4b67eb37142fb065ce0fb83b0bb184eab01b02 Mon Sep 17 00:00:00 2001
From: Logan Hunt <loganhunt@simponic.xyz>
Date: Tue, 12 Apr 2022 18:39:51 -0600
Subject: Let there be light

---
 src/routes/team/index.svelte | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 src/routes/team/index.svelte

(limited to 'src/routes/team/index.svelte')

diff --git a/src/routes/team/index.svelte b/src/routes/team/index.svelte
new file mode 100644
index 0000000..56a7e33
--- /dev/null
+++ b/src/routes/team/index.svelte
@@ -0,0 +1,43 @@
+<script>
+  import PersonCard from './PersonCard.svelte';  
+
+  import { onMount } from 'svelte';
+  import { supabase } from '$lib/supabase';
+
+  const getPeople = async () => {
+    const { data, error } = await supabase.from('people').select();
+    if (!error) {
+      return data;
+    }
+    console.log(error);
+    return [];
+  }
+
+  const mapImages = (people) => {
+    return people.map((x) => {
+      const { publicURL, error } = supabase
+        .storage
+        .from('mistymountains')
+        .getPublicUrl(x.image);
+      if (!error) {
+        return { ...x, image: publicURL };
+      }
+      return x;
+    });
+  }
+
+  let people = [];
+  onMount(async () => {
+    people = await getPeople().then(mapImages);
+  });
+</script>
+
+<main>
+  {#if people.length}
+    {#each people as person, i}
+      <div class="row">
+        <PersonCard person={person} direction={i % 2 ? 'left' : 'right'} />
+      </div>
+    {/each}
+  {/if}
+</main>
\ No newline at end of file
-- 
cgit v1.2.3-70-g09d2

