web/src/pages/index.astro

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