Skip to content

Commit 0cd5b9a

Browse files
committed
Add NoteBox component to display styled notes and remove notes section on functions page
1 parent 0667426 commit 0cd5b9a

File tree

3 files changed

+29
-22
lines changed

3 files changed

+29
-22
lines changed

web/src/components/NoteBox.astro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
// Componente reutilizável para exibir uma caixa de nota estilizada.
3+
// Ele usa um slot padrão para receber o conteúdo da nota.
4+
---
5+
<div class="custom-note-box">
6+
<slot /> {/* O conteúdo da nota será inserido aqui */}
7+
</div>
8+
9+
<style>
10+
.custom-note-box {
11+
background-color: var(--sl-color-blue-low); /* Tema Claro */
12+
border-left: 4px solid var(--sl-color-blue);
13+
border-radius: 8px;
14+
padding: 1rem 1.25rem;
15+
margin-bottom: 1rem; /* Espaço abaixo se houver múltiplas notas */
16+
color: var(--sl-color-text);
17+
}
18+
html[data-theme="dark"] .custom-note-box {
19+
background-color: var(--sl-color-gray-5); /* Tema Escuro */
20+
}
21+
</style>

web/src/pages/[func].astro

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import fs from "fs";
77
import path from "path";
88
import { Code } from '@astrojs/starlight/components';
99
10+
import NoteBox from '@src/components/NoteBox.astro';
1011
import '@src/styles/function-page.css';
1112
1213
export async function getStaticPaths() {
@@ -62,15 +63,13 @@ if (Array.isArray(funcNotes) && funcNotes.length > 0) {
6263
{description && <Fragment set:html={marked(description)} />}
6364

6465
<!-- Notes -->
65-
{notesContent.length > 0 && (
66-
<div class="notes-section">
67-
{notesContent.map((note) => (
68-
<div class="custom-note-box">
69-
<Fragment set:html={marked(note)} />
70-
</div>
71-
))}
72-
</div>
73-
)}
66+
<div class="notes-section">
67+
{notesContent.map((note) => (
68+
<NoteBox>
69+
<Fragment set:html={marked(note)} />
70+
</NoteBox>
71+
))}
72+
</div>
7473

7574
<!-- Examples -->
7675
{processedExamples.length > 0 && (

web/src/styles/function-page.css

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,6 @@
1515
padding-bottom: 0.25rem;
1616
}
1717

18-
.custom-note-box {
19-
background-color: var(--sl-color-blue-low);
20-
border-left: 4px solid var(--sl-color-blue);
21-
border-radius: 8px;
22-
padding: 1rem 1.25rem;
23-
margin-bottom: 1rem;
24-
color: var(--sl-color-text);
25-
}
26-
27-
html[data-theme="dark"] .custom-note-box {
28-
background-color: var(--sl-color-gray-5);
29-
}
30-
3118
.function-example {
3219
margin-bottom: 1.5rem;
3320
}

0 commit comments

Comments
 (0)