summaryrefslogtreecommitdiffhomepage
path: root/templates/root.templ
blob: 832846e1d3ffb4ee943c0b25740faf359b0ada50 (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
package templates

import (
	"strings"

	"git.thomasvoss.com/euro-cash.eu/i18n"
)

templ Root(head, body templ.Component) {
	{{ p := ctx.Value("printer").(i18n.Printer) }}

	<!DOCTYPE html>
	<html lang={ p.Locale.Code } data-theme={ ctx.Value("theme").(string) }>
		<head>
			<meta charset="UTF-8" />
			<meta name="viewport" content="width=device-width, initial-scale=1.0" />
			<link rel="stylesheet" type="text/css" href="/style.css" />
			<title>Euro Cash</title>
			if head != nil {
				@head
			}
		</head>
		<body>
			if body != nil {
				@body
			}
			<footer>
				<p>
					<small>
						{ p.T("Found a mistake or want to contribute missing information?") }
						<a href="/">{ p.T("Feel free to contact us!") }</a>
					</small>
				</p>
			</footer>
		</body>
	</html>
}

templ Index() {
	{{ p := ctx.Value("printer").(i18n.Printer) }}

	<header>
		@navbar()
		<hgroup>
			<h1>{ p.T("The Euro Cash Compendium") }</h1>
			<p>
				{ p.T("United in") }
				<del>{ p.T("diversity") }</del>
				<ins>{ p.T("cash") }</ins>
			</p>
		</hgroup>
	</header>
	<main>
		<p>
			{ p.T("Welcome to the Euro Cash Compendium. This sites aims to be a resource for you to discover everything there is to know about the coins and banknotes of the Euro, a currency that spans 26 countries and 350 million people. We also have dedicated sections of the site for collectors.") }
		</p>
	</main>
}

templ SetLanguage() {
	{{ p := ctx.Value("printer").(i18n.Printer) }}

	<header>
		@navbar()
		<h1>{ p.T("Select Your Language") }</h1>
	</header>

	<main>
		<p>
			{ p.T("Select your preferred language to use on the site.") }
		</p>
		<p>
			If you are an American user, it’s suggested that you select
			American English instead of British English. This will ensure that
			dates will be formatted with the month before the day. 
		</p>

		<hr />

		<h2>{ p.T("Eurozone Languages") }</h2>
		@languageGrid(true)

		<h2>{ p.T("Other Languages") }</h2>
		@languageGrid(false)
	</main>
}

templ languageGrid(eurozone bool) {
	<form action="/language" method="POST">
		<div class="lang-grid">
			for _, loc := range i18n.Locales {
				if loc.Eurozone == eurozone {
					<button
						type="submit"
						name="locale"
						value={ loc.Code }
						disabled?={ !loc.Enabled }
					>
						<span
							lang={ loc.Code }
							data-code={ strings.ToUpper(loc.Language()) }
						>
							{ loc.Name }
						</span>
					</button>
				}
			}
		</div>
	</form>
}