web/src/pages/all.astro
266 lines · 6767 bytes
1---
2
3
4import Layout from '@layouts/Layout.astro';
5import ServiceCard from '@components/things/ServiceCard.astro';
6import type { AwesomePrivacy, Section, Service } from '../types/Service';
7import { fetchData, slugify } from '@utils/fetch-data';
8import FontAwesome from '@components/form/FontAwesome.svelte';
9
10const categories = (await fetchData() as AwesomePrivacy)?.categories || [];
11
12---
13
14<script>
15
16const toggleSidebar = () => {
17 const intro = document.querySelector('#welcome-to-all');
18 const sidebar = document.querySelector('.sidebar');
19 sidebar && sidebar.classList.toggle('hidden');
20 intro && intro.classList.toggle('hidden');
21 const button = document.querySelector('#toggle-sidebar');
22 if (button) {
23 button.textContent = (button.textContent === "Show Contents" ? "Hide Contents" : "Show Contents");
24 }
25};
26
27 const tgt = document.querySelector("#toggle-sidebar");
28 tgt && tgt.addEventListener("click", () => {
29 toggleSidebar();
30 });
31</script>
32
33<Layout title="Awesome Privacy">
34 <main>
35 <div id="content">
36 <button id="toggle-sidebar">Show Contents</button>
37 <div id="welcome-to-all" class="hidden">
38 <p>
39 Welcome to <a href="/">Awesome Privacy</a>!
40 Here you'll find a summerized collection of all verified services we have listed.
41 <br /><br />
42 Click a section or category heading, to view more listings and privacy tips in that group,
43 or a service title to view it's complete privacy report
44 <br /><br />
45 Looking for something specific? Try the <a href="/search">Search</a> page, or take a
46 scroll through the <a href="/sitemap">Sitemap</a>
47 <br /><br />
48 If you want to make an edit, removal or submit an addition, then either click
49 the Edit button within any sub-page, or visit our <a href="/about">About</a> page
50 <br /><br />
51 This project, all it's data as well as source code is freely availible
52 on <a href="https://github.com/lissy93/awesome-privacy">GitHub</a>,
53 licensed under MIT, (C) <a href="https://aliciasykes.com">Alicia Sykes</a> 2024
54 </p>
55 </div>
56 <div class="sidebar hidden">
57 <p class="sidebar-title">Contents</p>
58 <ul>
59 {categories.map((category) => (
60 <li class="top-level">
61 <a href={`#${slugify(category.name)}`}>{category.name}</a>
62 </li>
63 <li>
64 <ul>
65 {category.sections.map((section: Section) => (
66 <li>
67 <a href={`#${slugify(category.name)}-${slugify(section.name)}`}>{section.name}</a>
68 </li>
69 ))}
70 </ul>
71 </li>
72 ))}
73 </ul>
74 </div>
75 {categories.map((category) => (
76 <h2 id={`${slugify(category.name)}`}>
77 <FontAwesome iconName={slugify(category.name)} />
78 <a href={`/${slugify(category.name)}`}>{category.name}</a>
79 </h2>
80
81 <article>
82 {category.sections.map((section: Section) => (
83 <h3 id={`${slugify(category.name)}-${slugify(section.name)}`}>
84 <a href={`/${slugify(category.name)}/${slugify(section.name)}`}>{section.name}</a>
85 </h3>
86 <section class="section">
87 { section.services.map((service: Service) => (
88 <ServiceCard service={service} sectionName={section.name} categoryName={category.name}/>
89 ))}
90 </section>
91 <div>
92 {!section || !section.services || section.services.length === 0 ? (
93 <div class="nothing-yet">
94 <p>
95 <strong>⚠️ This section is still a work in progress ⚠️</strong><br />
96 Check back soon, or help us complete it by submiting a pull request on GitHub.
97 </p>
98 </div>
99 ) : null}
100 </div>
101 ))}
102 </article>
103
104 ))}
105 </div>
106 </main>
107
108</Layout>
109
110<style lang="scss">
111
112main {
113 margin: 0 auto 2rem auto;
114 padding: 1rem;
115 width: 1200px;
116 max-width: calc(100% - 5rem);
117
118 display: flex;
119 justify-content: space-between;
120}
121
122// .narrow {
123// width: 70%;
124// }
125
126.hidden {
127 display: none;
128}
129
130#content {
131 margin: 0 auto;
132}
133
134#welcome-to-all {
135 text-align: justify;
136 width: 600px;
137 margin: 0 auto;
138 background: var(--background-form);
139 padding: 1rem;
140 border-radius: var(--curve-sm);
141}
142
143#toggle-sidebar {
144 // float: right;
145 background: none;
146 outline: none;
147 border: none;
148 cursor: pointer;
149 color: var(--accent);
150 &:hover {
151 text-decoration: underline;
152 }
153}
154
155
156.sidebar {
157 border-radius: var(--curve-md);
158 .sidebar-title {
159 font-size: 1.6rem;
160 background: var(--accent-3);
161 color: var(--accent-fg);
162 border: 2px solid var(--box-outline);
163 box-shadow: 6px 6px 0 var(--box-outline);
164 border-radius: var(--curve-sm);
165 margin: 1rem auto;
166 text-align: center;
167 }
168 ul {
169 list-style: none;
170 padding-left: 1.6rem;
171 column-width: 16rem;
172 a {
173 text-decoration: none;
174 color: var(--foreground);
175 transition: all 0.18s ease-in-out;
176 &:hover {
177 color: var(--accent);
178 opacity: 1;
179 }
180 }
181 li ul {
182 list-style: circle;
183 }
184 .top-level {
185 font-weight: bold;
186 margin-top: 0.5rem;
187 &:hover a {
188 color: var(--accent-3);
189 }
190 }
191 }
192}
193
194.section {
195 display: grid;
196 grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
197 gap: 1rem;
198 width: 100%;
199 margin: 0 auto;
200}
201
202.card {
203 margin: 2rem auto 5rem auto;
204 padding: 0 2rem;
205 border: 2px solid var(--box-outline);
206 box-shadow: 6px 6px 0 var(--box-outline);
207 background: var(--accent-fg);
208}
209
210h2 {
211 margin: 2rem auto 0 auto;
212 font-size: 3rem;
213 text-align: center;
214 opacity: 0.6;
215 display: flex;
216 justify-content: center;
217 align-items: center;
218 gap: 1rem;
219 a {
220 color: var(--accent-3);
221 text-decoration: none;
222 }
223 :global(svg) {
224 width: 3rem;
225 height: 3rem;
226 color: var(--accent-3);
227 }
228}
229
230h3 {
231 font-size: 2rem;
232 margin: 2rem 0 1rem 0;
233 box-shadow: 6px 6px 0 var(--box-outline);
234 background: var(--accent);
235 color: var(--accent-fg);
236 width: fit-content;
237 padding: 0.25rem 0.5rem;
238 a {
239 color: var(--accent-fg);
240 font-family: "Lekton", sans-serif;
241 text-decoration: none;
242 }
243 }
244
245 .nothing-yet {
246 width: 80vw;
247 margin: 0 auto;
248 background: var(--accent-fg);
249 border: 2px solid var(--box-outline);
250 box-shadow: 6px 6px 0 var(--box-outline);
251 border-radius: var(--curve-sm);
252
253 display: flex;
254 width: 80vw;
255 max-width: 28rem;
256 p {
257 font-size: 1.2rem;
258 opacity: 0.8;
259 font-style: italic;
260 text-align: center;
261 margin-bottom: 3rem;
262 }
263 }
264
265
266</style>