-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.html
145 lines (128 loc) · 5.38 KB
/
index.html
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<!doctype html>
<html lang="en">
<head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-LT9ZYVM869"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-LT9ZYVM869');
</script>
<meta charset="utf-8">
<meta name="viewport" conteSpt="width=device-width, initial-scale=1">
<title>Spack Packages</title>
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css?family=Source+Code+Pro:300,400"
rel="stylesheet">
<link rel="stylesheet"
href="//fonts.googleapis.com/css?family=Source+Sans+Pro:300,300i,600">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/fonts/remixicon.css"
rel="stylesheet">
<link rel="stylesheet" href="css/style.css">
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn.min.js"></script>
<script type="text/javascript">
const search = {
loaded: false,
query: '',
packages: [],
more_results: false,
init() {
this.loadPackages();
this.loaded = true;
},
async loadPackages() {
const response = await fetch('data/packages.json');
this.packages = await response.json();
},
get results() {
if (this.query.length < 2) {
return [];
}
const results = this.packages.filter(pkg => {
return pkg.name.toLowerCase().includes(this.query.toLowerCase());
})
this.more_results = results.length > 20;
return results.slice(0, 20);
},
packagePageUrl(pkg) {
return `package.html?name=${pkg.name}`;
}
};
</script>
</head>
<body class="bg-gray-100" x-data="search">
<div class="container mx-auto">
<section id="main" class="flex flex-col gap-12 h-screen max-w-[960px] mx-auto pt-4 md:pt-28 px-4 lg:px-0">
<!-- Header Section -->
<header class="flex items-center justify-between">
<div class="flex font-light gap-4 items-center justify-center text-2xl md:text-4xl">
<img src="img/spack-logo.svg" alt="Spack" class="w-[48px] md:w-[72px]">
Spack Packages
</div>
<div class="flex items-stretch">
<div class="tooltip tooltip-bottom" data-tip="Spack Cache">
<a href="https://cache.spack.io/" class="btn btn-ghost btn-square
rounded-btn" target="_blank" alt="Spack Cache">
<i class="ri-database-2-line text-xl"></i>
</a>
</div>
<div class="dropdown dropdown-end">
<label tabindex="0" class="btn btn-ghost btn-square rounded-btn">
<i class="ri-github-fill text-xl"></i>
</label>
<ul tabindex="0" class="menu dropdown-content p-2 shadow bg-base-100
rounded-box mt-4">
<li>
<a href="https://github.com/spack/packages.spack.io"
class="nolink" target="_blank">
<i class="ri-git-repository-fill text-xl"></i>
packages.spack.io
</a>
</li>
<li>
<a href="https://github.com/spack/cache.spack.io"
class="nolink" target="_blank">
<i class="ri-git-repository-fill text-xl"></i>
cache.spack.io
</a>
</li>
</ul>
</div>
</div>
</header>
<!-- Search Box -->
<div class="bg-primary border-l-4 border-secondary flex flex-col gap-8 p-8 rounded">
<div class="form-control">
<input type="text" placeholder="Search Packages" autofocus class="input input-bordered input-lg w-full" x-model="query">
</div>
</div>
<!-- Results Box -->
<div id="results" class="bg-base-100 border border-b-0 border-base-200 flex flex-col flex-grow overflow-y-auto rounded-t-xl shadow-xl" x-show="results.length" x-cloak>
<ul class="menu px-0 w-full">
<li class="menu-title !opacity-[0.6] py-2">
<span class="flex items-center justify-between">
Search Results
<small class="font-normal"><span x-text="results.length"></span><span x-show="more_results">+</span> packages found</small>
</span>
</li>
<template x-for="result in results">
<li class="hover-bordered border-t border-base-200">
<a :href="packagePageUrl(result)" class="!rounded-none hover:bg-gray-100">
<i class="ri-box-2-fill mr-2 text-3xl text-gray-300"></i>
<span class="flex-grow font-semibold text-primary">
<span x-text="result.name"></span>
<small class="block font-light text-neutral" x-text="result.description"></small>
</span>
<i class="ri-arrow-right-s-line text-xl text-gray-300"></i>
</a>
</li>
</template>
</ul>
</div>
</section>
</div>
</body>
</html>