Skip to content

Commit 8fe9ae2

Browse files
committed
feat(blocklists): redesign getting started page with path cards and comparison table
1 parent 8944c46 commit 8fe9ae2

7 files changed

Lines changed: 213 additions & 74 deletions

File tree

crowdsec-docs/docusaurus.config.ts

Lines changed: 52 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ import sidebarsUnversioned from "./sidebarsUnversioned";
88

99
const extractPreprocessor = require("./plugins/extract-preprocessor");
1010

11-
const generateCurrentAndNextRedirects = (s) => [
11+
const generateCurrentAndNextRedirects = (
12+
s: string,
13+
): { from: string; to: string }[] => [
1214
{
1315
from: `/docs/${s}`,
1416
to: `/u/${s}`,
@@ -19,7 +21,7 @@ const generateCurrentAndNextRedirects = (s) => [
1921
},
2022
];
2123

22-
function handleSidebarItems(items) {
24+
function handleSidebarItems(items: any[]): any[] {
2325
const arr = [];
2426
for (const item of items) {
2527
if (typeof item === "string") {
@@ -32,7 +34,7 @@ function handleSidebarItems(items) {
3234
}
3335

3436
// This function generates redirects for all items in the unversioned sidebars, so that if we move a doc from versioned to unversioned, we don't break existing links. It handles both string items (doc ids) and nested objects (categories with their own items).
35-
const backportRedirect = (s) => {
37+
const backportRedirect = (s: any): any[] => {
3638
const arr = [];
3739
if (typeof s === "string") {
3840
arr.push(...generateCurrentAndNextRedirects(s));
@@ -54,7 +56,9 @@ const backportRedirect = (s) => {
5456
const currentYear = new Date().getFullYear();
5557

5658
const ACADEMY_URL = `https://academy.crowdsec.net/courses?${
57-
process.env.NODE_ENV === "production" ? "utm_source=docs&utm_medium=menu&utm_campaign=top-menu&utm_id=academydocs" : ""
59+
process.env.NODE_ENV === "production"
60+
? "utm_source=docs&utm_medium=menu&utm_campaign=top-menu&utm_id=academydocs"
61+
: ""
5862
}`;
5963

6064
/** IF you make significant changes to the nav bar or side bars
@@ -153,7 +157,7 @@ const FOOTER_LINKS = [
153157
},
154158
{ label: "Discourse", href: "https://discourse.crowdsec.net/" },
155159
{ label: "Discord", href: "https://discord.gg/crowdsec" },
156-
{ label: "Twitter", href: "https://twitter.com/crowd_security" },
160+
{ label: "X", href: "https://x.com/crowd_security" },
157161
{ label: "LinkedIn", href: "https://www.linkedin.com/company/crowdsec/" },
158162
{ label: "YouTube", href: "https://www.youtube.com/@crowdsec" },
159163
],
@@ -169,7 +173,10 @@ const FOOTER_LINKS = [
169173
href: "https://crowdsec.net/blog/category/tutorial/",
170174
},
171175
{ label: "Academy", href: "https://academy.crowdsec.net/" },
172-
{ label: "Custom GPT", href: "https://chatgpt.com/g/g-682c3a61a78081918417571116c2b563-crowdsec-documentation" },
176+
{
177+
label: "Custom GPT",
178+
href: "https://chatgpt.com/g/g-682c3a61a78081918417571116c2b563-crowdsec-documentation",
179+
},
173180
],
174181
},
175182
];
@@ -202,21 +209,43 @@ const redirects = [
202209
},
203210
// CTI Web UI pages moved to console/ip_reputation
204211
{ from: "/u/cti_api/getting_started", to: "/u/console/ip_reputation/intro" },
205-
{ from: "/u/cti_api/api_getting_started", to: "/u/console/ip_reputation/api_keys" },
212+
{
213+
from: "/u/cti_api/api_getting_started",
214+
to: "/u/console/ip_reputation/api_keys",
215+
},
206216
{ from: "/u/cti_api/ip_report", to: "/u/console/ip_reputation/ip_report" },
207-
{ from: "/u/cti_api/search_queries", to: "/u/console/ip_reputation/search_ui" },
208-
{ from: "/u/cti_api/advanced_search", to: "/u/console/ip_reputation/search_ui_advanced" },
209-
{ from: "/u/cti_api/cve_explorer", to: "/u/console/ip_reputation/intro#live-exploit-tracker" },
217+
{
218+
from: "/u/cti_api/search_queries",
219+
to: "/u/console/ip_reputation/search_ui",
220+
},
221+
{
222+
from: "/u/cti_api/advanced_search",
223+
to: "/u/console/ip_reputation/search_ui_advanced",
224+
},
225+
{
226+
from: "/u/cti_api/cve_explorer",
227+
to: "/u/console/ip_reputation/intro#live-exploit-tracker",
228+
},
210229
// other CTI pages redirect / fixes
211230
{ from: "/next/cti_api/intro", to: "/u/console/ip_reputation/api_keys" },
212-
{ from: "/next/cti_api/getting_started", to: "/u/console/ip_reputation/api_keys" },
213-
{ from: "/u/console/ip_reputation/api_keys_premium", to: "/u/console/ip_reputation/api_keys" },
231+
{
232+
from: "/next/cti_api/getting_started",
233+
to: "/u/console/ip_reputation/api_keys",
234+
},
235+
{
236+
from: "/u/console/ip_reputation/api_keys_premium",
237+
to: "/u/console/ip_reputation/api_keys",
238+
},
214239
];
215240

216241
function redirectsGlobalDataPlugin() {
217242
return {
218243
name: "redirects-global-data",
219-
async contentLoaded({ actions }: { actions: { setGlobalData: (data: unknown) => void } }) {
244+
async contentLoaded({
245+
actions,
246+
}: {
247+
actions: { setGlobalData: (data: unknown) => void };
248+
}) {
220249
actions.setGlobalData({ redirects });
221250
},
222251
};
@@ -230,7 +259,8 @@ const config: Config = {
230259
experimental_faster: true,
231260
},
232261
title: "CrowdSec",
233-
tagline: "CrowdSec - Real-time & crowdsourced protection against aggressive IPs",
262+
tagline:
263+
"CrowdSec - Real-time & crowdsourced protection against aggressive IPs",
234264
url: "https://docs.crowdsec.net",
235265
baseUrl: "/",
236266
onBrokenLinks: "warn",
@@ -311,7 +341,8 @@ const config: Config = {
311341
{
312342
docs: {
313343
sidebarPath: "./sidebars.ts",
314-
editUrl: "https://github.com/crowdsecurity/crowdsec-docs/edit/main/crowdsec-docs/",
344+
editUrl:
345+
"https://github.com/crowdsecurity/crowdsec-docs/edit/main/crowdsec-docs/",
315346
lastVersion: "current",
316347
versions: {
317348
"v1.7": {
@@ -329,7 +360,8 @@ const config: Config = {
329360
},
330361
blog: {
331362
showReadingTime: true,
332-
editUrl: "https://github.com/crowdsecurity/crowdsec-docs/edit/main/crowdsec-docs/",
363+
editUrl:
364+
"https://github.com/crowdsecurity/crowdsec-docs/edit/main/crowdsec-docs/",
333365
},
334366
theme: {
335367
customCss: "./src/css/custom.css",
@@ -380,12 +412,14 @@ const config: Config = {
380412
{
381413
title: "CrowdSec Hub",
382414
url: "https://hub.crowdsec.net/",
383-
description: "Browse and install parsers, scenarios, collections, and remediation components",
415+
description:
416+
"Browse and install parsers, scenarios, collections, and remediation components",
384417
},
385418
{
386419
title: "CrowdSec Console",
387420
url: "https://app.crowdsec.net/",
388-
description: "Manage your CrowdSec deployments and access the community blocklist",
421+
description:
422+
"Manage your CrowdSec deployments and access the community blocklist",
389423
},
390424
{
391425
title: "GitHub Repository",

crowdsec-docs/src/components/docs/PathCard/index.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default function PathCard({ eyebrow, color, icon, title, desc, tag, tags
3939
href={href}
4040
onMouseEnter={() => setHover(true)}
4141
onMouseLeave={() => setHover(false)}
42-
className="relative p-6 rounded-[14px] overflow-hidden cursor-pointer flex flex-col no-underline min-w-0 transition-[border-color,background,box-shadow] duration-200"
42+
className="relative p-6 rounded-[14px] overflow-hidden cursor-pointer flex flex-col no-underline hover:no-underline min-w-0 transition-[border-color,background,box-shadow] duration-200"
4343
style={{
4444
color: "inherit",
4545
background: hover ? "var(--cs-surface-2)" : "var(--cs-surface)",
@@ -94,12 +94,14 @@ export default function PathCard({ eyebrow, color, icon, title, desc, tag, tags
9494
</div>
9595
)}
9696

97-
<div className="mt-5 pt-4 border-t border-dashed border-cs-border flex items-center justify-between">
98-
{audience && (
99-
<div className="font-cs-mono text-[10.5px] text-cs-ink-mute tracking-[0.06em] leading-[1.4] min-w-0 overflow-hidden">
97+
{audience && (
98+
<div className="font-cs-mono text-[10.5px] text-cs-ink-mute tracking-[0.06em] leading-[1.4] min-w-0 overflow-hidden mt-4">
10099
{audience}
101100
</div>
102101
)}
102+
103+
<div className="mt-3 pt-4 border-t border-cs-border flex items-center justify-between">
104+
103105
<div
104106
className="inline-flex items-center gap-1.5 font-semibold text-[13px] ml-auto whitespace-nowrap shrink-0 transition-[gap] duration-[160ms]"
105107
style={{ color }}

crowdsec-docs/src/css/alerts.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@
1212
top: 0.2rem !important;
1313
}
1414

15+
.alert .cs-admon__icon {
16+
@apply p-0.5;
17+
}
18+
1519
.alert svg {
16-
@apply !w-5 !h-5 mb-0;
20+
@apply !w-4 !h-4 mb-0;
1721
}
1822

1923
.alert--info {

crowdsec-docs/src/css/crowdsec-components.css

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -413,10 +413,6 @@ code:not(pre code):not(.cs-ic) {
413413
overflow: hidden;
414414
background: var(--cs-surface);
415415
}
416-
.cs-table-wrap table {
417-
margin: 0 !important;
418-
border: none !important;
419-
}
420416

421417
/* ── Direct table targeting (catches HTML tables too) ─────────── */
422418

@@ -515,6 +511,14 @@ article table tbody tr:hover td {
515511
background: color-mix(in srgb, var(--cs-orange) 4%, transparent) !important;
516512
}
517513

514+
/* ── Reset table styles when inside cs-table-wrap (after all general rules so this wins) */
515+
.cs-table-wrap table {
516+
margin: 0 !important;
517+
border: none !important;
518+
border-radius: 0 !important;
519+
overflow: visible !important;
520+
}
521+
518522
/* ── Pill component ─────────────────────────────────────────────── */
519523
.cs-pill {
520524
display: inline-flex;
@@ -578,6 +582,13 @@ article table tbody tr:hover td {
578582
border-bottom: 1px solid var(--cs-border) !important;
579583
margin-bottom: 0 !important;
580584
gap: 8px !important;
585+
flex-wrap: nowrap !important;
586+
overflow-x: auto !important;
587+
scrollbar-width: none !important;
588+
}
589+
590+
.tabs::-webkit-scrollbar {
591+
display: none !important;
581592
}
582593

583594
/* Individual tab items */
@@ -592,6 +603,8 @@ article table tbody tr:hover td {
592603
border-radius: 6px 6px 0 0 !important;
593604
border: none !important;
594605
border-bottom: 2px solid transparent !important;
606+
white-space: nowrap !important;
607+
flex-shrink: 0 !important;
595608
transition:
596609
color 0.12s,
597610
background 0.12s,

crowdsec-docs/src/css/crowdsec-tokens.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@
167167
}
168168

169169
.theme-doc-sidebar-item-link hr {
170-
visibility: hidden;
170+
background-color: var(--cs-border-hi) !important;
171171
margin: 0.25rem 0 !important;
172172
}
173173

0 commit comments

Comments
 (0)