summaryrefslogtreecommitdiff
path: root/src/routes/team/index.svelte
blob: 88e5db0861fa2b437102c15d5bf9324c99242710 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<script>
	import DirectionCard from '../../components/DirectionCard.svelte';

	import { onMount } from 'svelte';
	import { supabase } from '$lib/supabase';
	import { setImageUrl } from '$lib/utils';

	const getPeople = async () => {
		const { data, error } = await supabase.from('people').select().order('id');
		if (!error) {
			return data;
		}
		return [];
	};

	let people = [];
	onMount(async () => {
		people = await getPeople().then((people) => people.map(setImageUrl));
	});
</script>

<main>
	<h1 class="text-center">Our Team</h1>
	{#if people.length}
		{#each people as person, i}
			<div class="row border-bottom">
				<DirectionCard
					imageSpec={{ image: person.image, alt: person.name }}
					direction={i % 2 ? 'left' : 'right'}
				>
					<h2>{person.name}, {person.position}</h2>
					<p style="white-space: pre-line">{person.bio}</p>
					<a href="mailto:{person.email}"><p>{person.email}</p></a>
				</DirectionCard>
			</div>
		{/each}
	{/if}
</main>