-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathservices.ts
More file actions
78 lines (70 loc) · 1.58 KB
/
Copy pathservices.ts
File metadata and controls
78 lines (70 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import { is } from "../shared/is";
import { IService } from "../shared/types";
import { Anchor } from "./anchor";
import { Icon } from "./icon";
interface IServicesProps {
services: IService[];
categoryBubblePadding?: boolean;
}
export const Services = function (props: IServicesProps) {
const { services, categoryBubblePadding } = props;
return `
<ul class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-1 lg:gap-2 lg:gap-y-4">
${services.map((service, index) => Service({ index, service, categoryBubblePadding })).join("")}
</ul>
`;
};
interface IServiceProps {
service: IService;
index: number;
categoryBubblePadding?: boolean;
}
function Service(props: IServiceProps) {
const { service, index, categoryBubblePadding } = props;
const {
name,
uri,
description,
icon,
iconLight,
iconDark,
iconBG,
iconBubble,
iconBubblePadding,
iconColor,
iconAspect,
newWindow,
} = service;
return `
<li class="p-4">
${Anchor({
uri,
newWindow,
className: "flex gap-4",
children: `${
!is.null(icon)
? `<span class="shrink-0 flex">${Icon({
name,
icon,
iconLight,
iconDark,
uri,
index,
iconColor,
iconBG,
iconBubble,
iconAspect,
newWindow,
categoryBubblePadding,
iconBubblePadding,
})}</span>`
: ``
}
<div>
<h3 class="text-lg mt-1 font-semibold line-clamp-1">${name}</h3>
${!is.null(description) ? `<p class="text-sm text-black/50 dark:text-white/50 line-clamp-1">${description}</p>` : ``}
</div>`,
})}
</li>
`;
}