web/src/components/things/ServiceCard.astro
81 lines · 2019 bytes
1---
2import { formatLink, codebergUrl } from '@utils/parse-markdown';
3import type { Service } from 'src/types/Service';
4import FontAwesome from '@components/form/FontAwesome.svelte';
5import SaveListing from '@components/things/SaveListing.svelte';
6import ServiceIcon from '@components/things/ServiceIcon.astro';
7import { slugify } from '@utils/fetch-data';
8
9interface Props {
10 service: Service;
11 categoryName: string;
12 sectionName: string;
13}
14
15const { service, sectionName, categoryName } = Astro.props;
16---
17
18<div class="service" id={slugify(service.name)}>
19 <div class="service-head">
20 <a
21 class="service-title"
22 href={`/${slugify(categoryName)}/${slugify(sectionName)}/${slugify(service.name)}`}
23 >
24 <h4>{service.name}</h4>
25 </a>
26 {service.followWith && <p class="follow-with">({service.followWith})</p>}
27 </div>
28
29 <div class="save-listing">
30 <SaveListing
31 client:visible
32 categoryName={categoryName}
33 sectionName={sectionName}
34 serviceName={service.name}
35 />
36 </div>
37
38 <div class="service-body">
39 <ServiceIcon name={service.name} url={service.url} icon={service.icon} />
40 <div class="service-body">
41 <p set:html={service.description} />
42 </div>
43 </div>
44
45 <div class="service-links">
46 <a class="link" href={service.url}>
47 <FontAwesome iconName="website" />
48 <span>{formatLink(service.url)}</span>
49 </a>
50 {
51 service.github && (
52 <a class="link" href={`https://github.com/${service.github}`}>
53 <FontAwesome iconName="sourceCode" /> GitHub
54 </a>
55 )
56 }
57 {
58 service.codeberg && (
59 <a class="link" href={codebergUrl(service.codeberg)}>
60 <FontAwesome iconName="sourceCode" /> Codeberg
61 </a>
62 )
63 }
64 {
65 service.git && (
66 <a class="link" href={service.git}>
67 <FontAwesome iconName="sourceCode" /> Source
68 </a>
69 )
70 }
71 <a
72 href={`/${slugify(categoryName)}/${slugify(sectionName)}/${slugify(service.name)}`}
73 >
74 <FontAwesome iconName="viewReport" /> View Report ➔
75 </a>
76 </div>
77</div>
78
79<style lang="scss">
80 @use './service-card.scss';
81</style>