Skip to content

Commit ec1553e

Browse files
committed
basic codeblock component
1 parent 1534b1e commit ec1553e

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

src/components/CodeBlock.astro

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
// No props needed, just slot content
3+
---
4+
<pre class="code-block"><code><slot /></code></pre>
5+
6+
<style lang="scss">
7+
.code-block {
8+
background: var(--code-bg, #fff);
9+
padding: 1rem;
10+
border-radius: 4px;
11+
overflow-x: auto;
12+
margin: 1.5rem 0;
13+
font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
14+
font-size: 0.95em;
15+
font-weight: 300;
16+
color: var(--text-body-primary);
17+
}
18+
19+
.code-block code {
20+
background: none;
21+
padding: 0;
22+
border-radius: 0;
23+
font-size: inherit;
24+
font-family: inherit;
25+
color: inherit;
26+
white-space: pre;
27+
}
28+
</style>

src/pages/iot.astro

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,26 @@ import HeaderSection from "../components/HeaderSection.astro";
2424
import ImageURL from "../components/image/ImageURL.astro";
2525
import ImageCarousel from "../components/image/ImageCarousel.astro";
2626
import ContentLimiter from "../components/ContentLimiter.astro";
27+
import CodeBlock from "../components/CodeBlock.astro";
28+
29+
const codeExample = `
30+
# easy provision new devices with REST API
31+
curl -X POST https://your.defguard.insn.ce/api/v1/device/network/start_cli \
32+
-H "Authorization: Bearer X8q324nocap3laHG^nladfasd" \
33+
-H "Content-Type: application/json" \
34+
-d '{
35+
"name": "sf-charger-24",
36+
"location_id": 1,
37+
"assigned_ips": ["10.0.0.24"],
38+
"description": "Charger 24 in San Francisco network"
39+
}'
40+
{"enrollment_token":"hiiJGYyQ69KbEyLk3OhTkIhXYKzHoIdi","enrollment_url":"https://enrollyour.defguard.insn.ce/"}
41+
42+
# One simple command on the device
43+
44+
bash# dg enroll -t hiiJGYyQ69KbEyLk3OhTkIhXYKzHoIdi -u "https://enrollyour.defguard.insn.ce"
45+
`;
46+
2747
const testimonialsImportData = await Astro.glob("../data/home/testimonials/**/*.md");
2848
2949
const testimonialsData: Array<TestimonialData> = testimonialsImportData.map((val) => {
@@ -82,8 +102,11 @@ const tags = [
82102
/>
83103
<ContentLimiter >
84104
<ImageURL src="/images/iot/IoT.png" alt="Defguard and IoT and Edge Devices" />
85-
</ContentLimiter>
86105

106+
<CodeBlock>
107+
{codeExample}
108+
</CodeBlock>
109+
</ContentLimiter>
87110

88111
<!--
89112

0 commit comments

Comments
 (0)