Skip to content

Commit 1284d50

Browse files
Merge branch 'main' into mobile
2 parents 6fc1e2b + e9143b1 commit 1284d50

File tree

11 files changed

+425
-7
lines changed

11 files changed

+425
-7
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@
4747
"rehype-external-links": "^2.1.0",
4848
"rehype-raw": "^7.0.0",
4949
"sass": "^1.89.2",
50-
"sharp": "0.33.5",
50+
"sharp": "0.34.0",
51+
"shiki": "^3.8.1",
5152
"short-unique-id": "^5.3.2",
5253
"slick-carousel": "^1.8.1",
5354
"typescript": "^5.8.3",

public/images/iot/IoT.png

261 KB
Loading

public/images/iot/acl.png

67.8 KB
Loading

public/images/iot/manage.png

111 KB
Loading

public/images/iot/network-devices.png

25.3 KB
Loading

public/images/iot/stations.png

223 KB
Loading

src/components/CodeBlock.astro

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
---
2+
import { codeToHtml } from 'shiki';
3+
4+
const { code, lang = "bash" } = Astro.props;
5+
const highlighted = await codeToHtml(code, {
6+
lang,
7+
theme: 'github-light'
8+
});
9+
---
10+
11+
<div class="code-block-wrapper">
12+
<button class="copy-button" data-code={code} title="Copy code">
13+
<i class="lni lni-clipboard"></i>
14+
</button>
15+
<Fragment set:html={highlighted} />
16+
</div>
17+
18+
<script>
19+
document.addEventListener('DOMContentLoaded', function() {
20+
const copyButtons = document.querySelectorAll('.copy-button');
21+
22+
copyButtons.forEach(button => {
23+
button.addEventListener('click', async function(this: HTMLButtonElement) {
24+
const code = this.dataset.code;
25+
const icon = this.querySelector('i');
26+
27+
if (!code || !icon) return;
28+
29+
try {
30+
await navigator.clipboard.writeText(code);
31+
32+
// Change icon to checkmark
33+
icon.className = 'lni lni-checkmark';
34+
35+
// Reset icon after 2 seconds
36+
setTimeout(() => {
37+
icon.className = 'lni lni-clipboard';
38+
}, 2000);
39+
} catch (err) {
40+
console.error('Failed to copy text: ', err);
41+
}
42+
});
43+
});
44+
});
45+
</script>
46+
47+
<style lang="scss">
48+
.code-block-wrapper {
49+
position: relative;
50+
51+
.copy-button {
52+
position: absolute;
53+
top: 0.5rem;
54+
right: 0.5rem;
55+
z-index: 10;
56+
background: var(--surface-frame-bg);
57+
border: 1px solid var(--border-separator);
58+
border-radius: 4px;
59+
padding: 0.5rem;
60+
cursor: pointer;
61+
transition: all 0.2s ease-in-out;
62+
display: flex;
63+
align-items: center;
64+
justify-content: center;
65+
opacity: 0.7;
66+
67+
&:hover {
68+
opacity: 1;
69+
background: var(--surface-main-primary);
70+
color: white;
71+
transform: translateY(-1px);
72+
}
73+
74+
i {
75+
font-size: 1rem;
76+
color: inherit;
77+
}
78+
}
79+
}
80+
81+
:global(pre) {
82+
background: var(--code-bg, #fff);
83+
padding: 1rem;
84+
border-radius: 4px;
85+
overflow-x: hidden;
86+
white-space: pre-wrap;
87+
margin: 0;
88+
}
89+
90+
:global(code) {
91+
font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
92+
font-size: 0.666em;
93+
font-weight: 300;
94+
background: var(--code-bg, #fff);
95+
padding: 0.2em 0.4em;
96+
border-radius: 3px;
97+
}
98+
</style>

src/data/nav.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818
"external": false
1919
},
2020
{
21-
"display": "Compare",
22-
"url": "/compare/",
23-
"prefetch": true
21+
"display": "IoT",
22+
"url": "/iot/",
23+
"prefetch": true,
24+
"external": false
2425
},
2526
{
2627
"display": "Enterprise",
27-
"url": "https://docs.defguard.net/enterprise",
28+
"url": "https://docs.defguard.net/enterprise/enterprise-features",
2829
"prefetch": false,
2930
"external": true
3031
},

src/pages/_home/components/HomeHeader.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const { trustedBy = true, title, description, buttons = [], repo = "defguard", s
6060

6161
<style lang="scss" is:global>
6262
#home-header {
63-
padding-bottom: page-spacing(60px);
63+
padding-bottom: page-spacing(30px);
6464
padding-top: 50px;
6565

6666
& > p {

0 commit comments

Comments
 (0)