Skip to content

Commit 8b51499

Browse files
committed
fix ♻️ PR feedbacks
1 parent 40ec111 commit 8b51499

File tree

9 files changed

+52
-37
lines changed

9 files changed

+52
-37
lines changed

crowdsec-docs/docusaurus.config.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,22 +99,22 @@ const NAVBAR_ITEMS: NavbarItem[] = [
9999
{
100100
href: "https://github.com/crowdsecurity/crowdsec",
101101
position: "right",
102-
className: "header-github-link header-icon-link",
102+
className: "header-github-link header-icon-link invert dark:invert-0",
103103
},
104104
{
105105
href: "https://discord.gg/wGN7ShmEE8",
106106
position: "right",
107-
className: "header-discord-link",
107+
className: "header-discord-link invert dark:invert-0",
108108
},
109109
{
110110
href: "https://discourse.crowdsec.net",
111111
position: "right",
112-
className: "header-discourse-link",
112+
className: "header-discourse-link invert dark:invert-0",
113113
},
114114
{
115115
href: "https://hub.crowdsec.net/",
116116
position: "right",
117-
className: "header-hub-link",
117+
className: "header-hub-link dark:invert",
118118
},
119119
];
120120

@@ -187,10 +187,15 @@ const config: Config = {
187187
],
188188
themeConfig: {
189189
image: "img/crowdsec_og_image.png",
190+
colorMode: {
191+
defaultMode: "dark",
192+
disableSwitch: false,
193+
respectPrefersColorScheme: true,
194+
},
190195
announcementBar: {
191196
id: "banner_docs",
192197
content:
193-
'<a target="_blank" href="https://doc.crowdsec.net/docs/next/appsec/intro">Learn how to guard your webserver in real-time with the CrowdSec WAF</a>',
198+
'<a target="_blank" href="https://doc.crowdsec.net/docs/next/appsec/intro" rel="noopener">Learn how to guard your webserver in real-time with the CrowdSec WAF</a>',
194199
backgroundColor: "#F8AB13",
195200
textColor: "#131132",
196201
isCloseable: true,

crowdsec-docs/src/components/UnderlineTooltip.js

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { HybridTooltip, HybridTooltipContent, HybridTooltipTrigger, TouchProvider } from "@site/src/ui/hybridtooltip";
2+
import React from "react";
3+
4+
export default function UnderlineTooltip({ children, tooltip }): React.JSX.Element {
5+
return (
6+
<TouchProvider>
7+
<HybridTooltip delayDuration={300}>
8+
<HybridTooltipTrigger asChild>
9+
<span className="underline decoration-dashed decoration-1 duration-300 decoration-border dark:decoration-foreground cursor-help hover:decoration-foreground/80 underline-offset-2">
10+
{children}
11+
</span>
12+
</HybridTooltipTrigger>
13+
<HybridTooltipContent>{tooltip}</HybridTooltipContent>
14+
</HybridTooltip>
15+
</TouchProvider>
16+
);
17+
}

crowdsec-docs/src/css/custom.css

Lines changed: 9 additions & 8 deletions
Large diffs are not rendered by default.

crowdsec-docs/src/ui/hybridtooltip.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import { PopoverContentProps, PopoverProps, PopoverTriggerProps } from "@radix-ui/react-popover";
44
import { TooltipContentProps, TooltipProps, TooltipTriggerProps } from "@radix-ui/react-tooltip";
5+
import clsx from "clsx";
56
import React, { createContext, PropsWithChildren, useContext, useEffect, useState } from "react";
67
import { Popover, PopoverContent, PopoverTrigger } from "./popover";
78
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./tooltip";
@@ -45,5 +46,10 @@ export const HybridTooltipTrigger = (props: TooltipTriggerProps & PopoverTrigger
4546
export const HybridTooltipContent = (props: TooltipContentProps & PopoverContentProps) => {
4647
const isTouch = useTouch();
4748

48-
return isTouch ? <PopoverContent {...props} /> : <TooltipContent {...props} />;
49+
const newClassName = clsx(
50+
props.className,
51+
"bg-background dark:bg-gray-50 border border-border/40 dark:border-border border-solid rounded-md px-2 text-sm dark:font-medium"
52+
);
53+
54+
return isTouch ? <PopoverContent {...props} className={newClassName} /> : <TooltipContent {...props} className={newClassName} />;
4955
};

crowdsec-docs/src/ui/popover.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const PopoverContent = React.forwardRef<
1818
align={align}
1919
sideOffset={sideOffset}
2020
className={cn(
21-
"tw-z-50 tw-w-72 tw-rounded-md tw-border tw-border-neutral-200 tw-bg-neutral-100 tw-p-4 tw-text-neutral-950 tw-shadow-md tw-outline-none data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out data-[state=closed]:tw-fade-out-0 data-[state=open]:tw-fade-in-0 data-[state=closed]:tw-zoom-out-95 data-[state=open]:tw-zoom-in-95 data-[side=bottom]:tw-slide-in-from-top-2 data-[side=left]:tw-slide-in-from-right-2 data-[side=right]:tw-slide-in-from-left-2 data-[side=top]:tw-slide-in-from-bottom-2 tw-origin-[--radix-popover-content-transform-origin] dark:tw-border-neutral-800 dark:tw-bg-neutral-950 dark:tw-text-neutral-50",
21+
"z-50 w-72 rounded-md border border-neutral-200 bg-neutral-100 p-4 text-neutral-950 shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin] dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50",
2222
className
2323
)}
2424
{...props}

crowdsec-docs/src/ui/tooltip.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const TooltipContent = React.forwardRef<
1818
ref={ref}
1919
sideOffset={sideOffset}
2020
className={cn(
21-
"tw-z-50 tw-overflow-hidden tw-rounded-md tw-border tw-border-neutral-200 tw-bg-neutral-100 tw-px-3 tw-py-1.5 tw-text-sm tw-text-neutral-950 tw-shadow-md tw-animate-in tw-fade-in-0 tw-zoom-in-95 data-[state=closed]:tw-animate-out data-[state=closed]:tw-fade-out-0 data-[state=closed]:tw-zoom-out-95 data-[side=bottom]:tw-slide-in-from-top-2 data-[side=left]:tw-slide-in-from-right-2 data-[side=right]:tw-slide-in-from-left-2 data-[side=top]:tw-slide-in-from-bottom-2 dark:tw-border-neutral-800 dark:tw-bg-neutral-950 dark:tw-text-neutral-50",
21+
"z-50 overflow-hidden rounded-md border border-neutral-200 bg-neutral-100 px-3 py-1.5 text-sm text-neutral-950 shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50",
2222
className
2323
)}
2424
{...props}

crowdsec-docs/tailwind.config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ module.exports = {
3838
background: `rgb(var(--background) / <alpha-value>)`,
3939
foreground: `rgb(var(--foreground) / <alpha-value>)`,
4040
success: `rgb(var(--color-green) / <alpha-value>)`,
41-
premium: `rgb(var(--color-premium) / <alpha-value>)`,
4241
platinum: `rgb(var(--color-platinum) / <alpha-value>)`,
4342
card: `rgb(var(--card) / <alpha-value>)`,
4443
"card-foreground": `rgb(var(--card-foreground) / <alpha-value>)`,
@@ -52,6 +51,12 @@ module.exports = {
5251
},
5352
},
5453
},
54+
safelist: [
55+
{
56+
pattern: /invert(-0)?/,
57+
variants: ["dark", "light", "before"],
58+
},
59+
],
5560
plugins: [require("tailwindcss-animate")],
5661
prefix: "", // This is the prefix for the tailwind classes to not clash with docusarus classes
5762
};

crowdsec-docs/unversioned/getting_started/introduction.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sidebar_position: 1
55
---
66

77
import useBaseUrl from "@docusaurus/useBaseUrl"
8-
import UnderlineTooltip from "@site/src/components/UnderlineTooltip"
8+
import UnderlineTooltip from "@site/src/components/underline-tooltip"
99

1010
## What is CrowdSec Security Engine?
1111

0 commit comments

Comments
 (0)