-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
287 lines (264 loc) · 9.34 KB
/
Copy pathindex.html
File metadata and controls
287 lines (264 loc) · 9.34 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
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tool Hub</title>
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
--bg: #1a1a2e;
--surface: #16213e;
--border: #0f3460;
--accent: #00d4ff;
--text: #eee;
--muted: #888;
--tag-bg: rgba(0, 212, 255, 0.10);
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: var(--bg);
color: var(--text);
min-height: 100vh;
padding: 48px 20px 60px;
}
header {
text-align: center;
margin-bottom: 48px;
}
header h1 {
font-size: clamp(1.6rem, 4vw, 2.6rem);
color: var(--accent);
letter-spacing: 0.02em;
}
header p {
margin-top: 8px;
color: var(--muted);
font-size: 0.95rem;
}
/* ── Search / filter bar ── */
.toolbar {
display: flex;
gap: 12px;
flex-wrap: wrap;
justify-content: center;
margin-bottom: 36px;
}
.search-wrap {
position: relative;
flex: 1 1 240px;
max-width: 420px;
}
.search-wrap svg {
position: absolute;
left: 10px;
top: 50%;
transform: translateY(-50%);
pointer-events: none;
opacity: 0.4;
}
#searchInput {
width: 100%;
padding: 9px 12px 9px 34px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: 8px;
color: var(--text);
font-size: 14px;
}
#searchInput:focus { outline: none; border-color: var(--accent); }
#tagFilter {
display: flex;
gap: 6px;
flex-wrap: wrap;
align-items: center;
}
.tag-btn {
background: var(--surface);
border: 1px solid var(--border);
color: var(--muted);
padding: 5px 12px;
border-radius: 20px;
cursor: pointer;
font-size: 12px;
transition: all 0.15s;
}
.tag-btn:hover { border-color: var(--accent); color: var(--accent); }
.tag-btn.active {
background: var(--tag-bg);
border-color: var(--accent);
color: var(--accent);
}
/* ── Grid ── */
#toolGrid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
gap: 20px;
max-width: 1100px;
margin: 0 auto;
}
.tool-card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 12px;
padding: 20px;
display: flex;
flex-direction: column;
gap: 10px;
text-decoration: none;
color: inherit;
transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}
.tool-card:hover {
border-color: var(--accent);
transform: translateY(-3px);
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.card-icon {
font-size: 2rem;
line-height: 1;
}
.card-name {
font-size: 1.05rem;
font-weight: 600;
color: var(--accent);
}
.card-desc {
font-size: 0.85rem;
color: var(--muted);
flex: 1;
line-height: 1.5;
}
.card-tags {
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.card-tag {
background: var(--tag-bg);
border: 1px solid var(--border);
color: var(--accent);
font-size: 11px;
padding: 2px 8px;
border-radius: 12px;
}
/* empty state */
#emptyMsg {
display: none;
grid-column: 1 / -1;
text-align: center;
color: var(--muted);
padding: 40px 0;
font-size: 0.95rem;
}
</style>
</head>
<body>
<header>
<h1>Tool Hub</h1>
<p>A collection of browser-based utilities — no install required.</p>
</header>
<div class="toolbar">
<div class="search-wrap">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/>
</svg>
<input id="searchInput" type="search" placeholder="Search tools…" autocomplete="off">
</div>
<div id="tagFilter"></div>
</div>
<div id="toolGrid">
<div id="emptyMsg">No tools match your search.</div>
</div>
<script>
// ─────────────────────────────────────────────────────────────────────────
// TOOL LIST — add / edit entries here.
//
// Each entry:
// url : relative path (or absolute URL) to the tool
// name : display name
// icon : emoji shown on the card
// desc : short description
// tags : array of tag strings used for filtering
// ─────────────────────────────────────────────────────────────────────────
const TOOLS = [
{
url: 'percentage-splitter.html',
name: 'Percentage Splitter',
icon: '📊',
desc: 'Visually split a total value into named, colored chunks using an interactive drag slider.',
tags: ['math', 'finance']
},
// ── Add more tools below this line ──────────────────────────────────
// {
// url: 'my-tool.html',
// name: 'My Tool',
// icon: '🔧',
// desc: 'What it does.',
// tags: ['category']
// },
];
// ─────────────────────────────────────────────────────────────────────────
const grid = document.getElementById('toolGrid');
const emptyMsg = document.getElementById('emptyMsg');
const searchInput = document.getElementById('searchInput');
const tagFilter = document.getElementById('tagFilter');
// Collect unique tags
const allTags = [...new Set(TOOLS.flatMap(t => t.tags))].sort();
// Build tag buttons
let activeTag = null;
function buildTagButtons() {
tagFilter.innerHTML = '';
const allBtn = document.createElement('button');
allBtn.className = 'tag-btn' + (activeTag === null ? ' active' : '');
allBtn.textContent = 'All';
allBtn.addEventListener('click', () => { activeTag = null; buildTagButtons(); applyFilters(); });
tagFilter.appendChild(allBtn);
allTags.forEach(tag => {
const btn = document.createElement('button');
btn.className = 'tag-btn' + (activeTag === tag ? ' active' : '');
btn.textContent = tag;
btn.addEventListener('click', () => {
activeTag = (activeTag === tag) ? null : tag;
buildTagButtons();
applyFilters();
});
tagFilter.appendChild(btn);
});
}
function applyFilters() {
const query = searchInput.value.trim().toLowerCase();
const visible = TOOLS.filter(t => {
const matchesTag = !activeTag || t.tags.includes(activeTag);
const matchesSearch = !query ||
t.name.toLowerCase().includes(query) ||
t.desc.toLowerCase().includes(query) ||
t.tags.some(tag => tag.toLowerCase().includes(query));
return matchesTag && matchesSearch;
});
// Clear existing cards (keep emptyMsg)
Array.from(grid.querySelectorAll('.tool-card')).forEach(el => el.remove());
if (visible.length === 0) {
emptyMsg.style.display = 'block';
} else {
emptyMsg.style.display = 'none';
visible.forEach(tool => {
const card = document.createElement('a');
card.className = 'tool-card';
card.href = tool.url;
card.innerHTML = `
<div class="card-icon">${tool.icon}</div>
<div class="card-name">${tool.name}</div>
<div class="card-desc">${tool.desc}</div>
<div class="card-tags">${tool.tags.map(t => `<span class="card-tag">${t}</span>`).join('')}</div>
`;
grid.appendChild(card);
});
}
}
searchInput.addEventListener('input', applyFilters);
buildTagButtons();
applyFilters();
</script>
</body>
</html>