web/src/pages/index.astro

226 lines · 5844 bytes

  1---
  2import Layout from '@layouts/Layout.astro';
  3import Hero from '@components/Hero.astro';
  4import Search from '@components/things/Search.svelte';
  5import SectionList from '@components/things/SectionList.astro';
  6import SavedServices from '@components/things/SavedServices.svelte';
  7import LatestUpdates from '@components/things/LatestUpdates.astro';
  8
  9import { fetchData } from '@utils/fetch-data';
 10import type { Category } from 'src/types/Service';
 11
 12const categories = (await fetchData())?.categories || ([] as Category[]);
 13
 14const description =
 15	'Privacy is a fundamental human right; ' +
 16	"without it, we're just open books in a world where everyone's " +
 17	"watching. Let's take control back.\n" +
 18	'Migrating open-source applications which do not collect, sell or log your data is a great first step.' +
 19	'Awesome Privacy is a directory of alternative privacy-respecting software and services.';
 20---
 21
 22<Layout title="Home | Awesome Privacy" description={description}>
 23	<Hero />
 24	<main>
 25		<div class="action-card">
 26			<Search client:visible data={categories} />
 27			<span class="action-divider">or</span>
 28			<a href="/all" class="browse-cta"> Browse All Listings &rarr; </a>
 29		</div>
 30		<h2 class="browse-title"><a href="/all">Categories</a></h2>
 31		<ul class="categories">
 32			{
 33				categories.map((category) => (
 34					<li class="category">
 35						<SectionList title={category.name} sections={category.sections} />
 36					</li>
 37				))
 38			}
 39		</ul>
 40		<div class="categories-footer">
 41			<a class="small-button" href="/all">View everything &rarr;</a>
 42		</div>
 43
 44		<h2><a href="/changelog">Latest Updates</a></h2>
 45		<LatestUpdates categories={categories} />
 46
 47		<h2><a href="/inventory">Saved Items</a></h2>
 48		<SavedServices allData={categories} client:load />
 49
 50		<h2>
 51			<a href="/about">About</a>
 52		</h2>
 53		<div class="about-summary">
 54			<p>
 55				Awesome Privacy is a collection of privacy-respecting services and
 56				tools. The aim is to help you escape big tech, and choose software that
 57				respects your privacy.
 58			</p>
 59			<p>
 60				Why? Because privacy is a fundamental human right; without it, we're
 61				just open books in a world where everyone's watching. Let's take control
 62				back.
 63			</p>
 64			<p>
 65				Noticed something that should be added / removed / amended? We're a
 66				community-driven resource, so welcome contributions of any nature. All
 67				content and code is <a href="https://github.com/lissy93/awesome-privacy"
 68					>open source</a
 69				>.
 70			</p>
 71			<p>
 72				If you've found Awesome Privacy useful, help us out by sharing it with
 73				others, contributing, or consider <a
 74					href="https://github.com/sponsors/lissy93">sponsoring me</a
 75				> on GitHub.
 76			</p>
 77			<div class="about-footer">
 78				<a class="small-button" href="/about">Keep reading &rarr;</a>
 79			</div>
 80		</div>
 81	</main>
 82</Layout>
 83
 84<style lang="scss">
 85	@use '../styles/mixins' as *;
 86	main {
 87		margin: auto;
 88		padding: var(--space-md);
 89		width: var(--width-container);
 90		max-width: var(--width-container-max);
 91		font-size: 20px;
 92		line-height: 1.6;
 93		@media (max-width: 768px) {
 94			padding: 0;
 95		}
 96		.categories-footer {
 97			display: flex;
 98			justify-content: flex-end;
 99			margin: var(--space-md) 0;
100		}
101	}
102	.action-card {
103		display: flex;
104		align-items: end;
105		gap: var(--space-md);
106		background: var(--accent-fg);
107		border: var(--border-heavy);
108		border-radius: var(--curve-sm);
109		box-shadow: var(--shadow-lg);
110		padding: var(--space-md) var(--space-lg);
111		margin: var(--space-lg) auto;
112		width: 100%;
113		box-sizing: border-box;
114		:global(.search-wrap) {
115			flex: 1;
116			:global(label) {
117				font-size: var(--text-sm);
118			}
119		}
120		.action-divider {
121			font-family: var(--font-subtitle);
122			opacity: var(--opacity-soft);
123			flex-shrink: 0;
124		}
125		.browse-cta {
126			flex-shrink: 0;
127			padding: var(--space-sm) var(--space-lg);
128			background: var(--accent-3);
129			color: var(--accent-fg);
130			font-family: var(--font-subtitle);
131			font-size: var(--text-md);
132			font-weight: bold;
133			text-decoration: none;
134			border: var(--border-heavy);
135			box-shadow: var(--shadow-sm);
136			white-space: nowrap;
137			box-sizing: border-box;
138			&:hover {
139				box-shadow: var(--shadow-sm-hover);
140				opacity: 0.95;
141			}
142		}
143		@media (max-width: 768px) {
144			flex-direction: column;
145			align-items: center;
146			width: 95%;
147			padding: var(--space-md);
148			.browse-cta {
149				width: 100%;
150				text-align: center;
151			}
152		}
153	}
154
155	h2 {
156		font-size: var(--text-4xl);
157		color: var(--accent-3);
158		font-family: var(--font-subtitle);
159		text-align: center;
160		margin: var(--space-xl) 0 var(--space-md) 0;
161		a {
162			text-decoration: none;
163			color: var(--accent-3);
164			@include underline-hover(var(--accent));
165		}
166	}
167
168	.about-summary {
169		background: var(--accent-fg);
170		border: var(--border-heavy);
171		border-radius: var(--curve-sm);
172		box-shadow: var(--shadow-md);
173		padding: var(--space-md);
174		width: 100%;
175		box-sizing: border-box;
176		margin: 0 auto;
177		.about-footer {
178			display: flex;
179			justify-content: flex-end;
180			margin-top: var(--space-md);
181		}
182	}
183
184	.categories {
185		columns: 6 300px;
186		column-gap: var(--space-md);
187		padding: 0;
188		.category {
189			background: var(--accent-fg);
190			border: var(--border-heavy);
191			border-radius: var(--curve-sm);
192			box-shadow: var(--shadow-md);
193			padding: var(--space-md);
194			width: 85%;
195			display: inline-flex;
196			flex-direction: column;
197			margin: var(--space-md);
198			@media (max-width: 768px) {
199				margin: var(--space-md) 0;
200				width: 90%;
201			}
202			.category-title {
203				text-decoration: none;
204				color: var(--foreground);
205			}
206			h3 {
207				font-family: var(--font-subtitle);
208				font-weight: bold;
209				margin: 0;
210				font-size: var(--text-2xl);
211			}
212			.sections {
213				padding-left: var(--space-md);
214				.section {
215					a {
216						text-decoration: none;
217						color: var(--foreground);
218					}
219					.service-count {
220						color: var(--accent-3);
221					}
222				}
223			}
224		}
225	}
226</style>