summaryrefslogtreecommitdiff
path: root/examples/ssr/src/components/Header.astro
blob: d266733e907d202ad62f7e07d643f33a25f40898 (plain) (blame)
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
39
40
41
42
43
44
45
46
47
48
49
---
import TextDecorationSkip from './TextDecorationSkip.astro';
import Cart from './Cart.svelte';
import { getCart } from '../api';

const cart = await getCart(Astro.request);
const cartCount = cart.items.reduce((sum, item) => sum + item.count, 0);
---

<style>
	@import url('https://fonts.googleapis.com/css2?family=Lobster&display=swap');

	header {
		margin: 1rem 2rem;
		display: flex;
		justify-content: space-between;
	}

	h1 {
		margin: 0;
		font-family: 'Lobster', cursive;
		color: black;
	}

	a,
	a:visited {
		color: inherit;
		text-decoration: none;
	}

	.right-pane {
		display: flex;
	}

	.material-icons {
		font-size: 36px;
		margin-right: 1rem;
	}
</style>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
<header>
	<h1><a href="/"><TextDecorationSkip text="Online Store" /></a></h1>
	<div class="right-pane">
		<a href="/login">
			<span class="material-icons"> login</span>
		</a>
		<Cart client:idle count={cartCount} />
	</div>
</header>