web/src/components/things/ServiceCard.astro

67 lines · 1717 bytes

 1---
 2import { formatLink } 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		<a
58			href={`/${slugify(categoryName)}/${slugify(sectionName)}/${slugify(service.name)}`}
59		>
60			<FontAwesome iconName="viewReport" /> View Report ➔
61		</a>
62	</div>
63</div>
64
65<style lang="scss">
66	@use './service-card.scss';
67</style>