Skip to content

Commit 117020a

Browse files
enhance: fix img css and button on promos
1 parent 3d4da9b commit 117020a

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

crowdsec-docs/src/components/console-promo.tsx

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,33 @@
1+
import { useHistory } from "@docusaurus/router";
12
import useBaseUrl from "@docusaurus/useBaseUrl";
23
import { Button } from "@site/src/ui/button";
34
import { Card, CardContent, CardHeader } from "@site/src/ui/card";
45
import React from "react";
56

67
const ConsolePromo = ({ ...props }): React.JSX.Element => {
78
const url = useBaseUrl(`/img/${props.image}`);
9+
const isExternal = /^(?:[a-z]+:)?\/\//i.test(props.link);
10+
const history = useHistory();
811
return (
912
<Card className="min-h-[200px] flex flex-col">
1013
<CardHeader className="flex-shrink-0">{props.title ? <h3 className="text-left">{props.title}</h3> : null}</CardHeader>
1114
<CardContent className="flex-row flex space-x-4 flex-1">
1215
<div className="flex-col flex justify-between flex-1">
1316
{props.description ? <p className="text-left text-base text-card-foreground">{props.description}</p> : null}
1417
<div className="text-left">
15-
<a href={props.link} target="_blank">
16-
<Button color="primary" className="w-full md:w-1/2">
17-
{props.text ?? "Get Started"}
18-
</Button>
19-
</a>
18+
<Button
19+
color="primary"
20+
className="w-full md:w-1/2"
21+
onClick={() => {
22+
if (isExternal) {
23+
window.open(props.link, "_blank", "noopener,noreferrer");
24+
} else {
25+
history.push(props.link);
26+
}
27+
}}
28+
>
29+
{props.text ?? "Get Started"}
30+
</Button>
2031
</div>
2132
</div>
2233

crowdsec-docs/src/css/custom.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ html[data-theme="dark"] {
5757
}
5858

5959
/* IMAGE STYLES FOR PAGES*/
60-
.container img {
60+
main .container img:not(a img) {
6161
@apply border border-solid border-gray-300/80 dark:border-gray-300/80 rounded-lg p-2;
6262
}
6363

0 commit comments

Comments
 (0)