Skip to content

Commit 0bf4af1

Browse files
committed
refactor: keyword list in C++ keywords page
1 parent 9dbbf96 commit 0bf4af1

File tree

5 files changed

+235
-23
lines changed

5 files changed

+235
-23
lines changed

src/components/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import AutoCollapse from "@components/AutoCollapse.astro";
1515
import FlexTable from "@components/FlexTable.astro";
1616
import Incomplete from "@components/Incomplete.astro";
1717
import WG21PaperLink from "@components/WG21PaperLink.astro";
18+
import { KeywordColumn, KeywordGrid } from "@components/keyword-table";
1819

1920
export {
2021
Behavior,
@@ -38,4 +39,6 @@ export {
3839
FlexTable,
3940
Incomplete,
4041
WG21PaperLink,
42+
KeywordColumn,
43+
KeywordGrid,
4144
};
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
interface Props {
3+
title?: string;
4+
}
5+
6+
const { title } = Astro.props;
7+
---
8+
9+
<section class="keyword-column">
10+
{title ? <div class="keyword-column-title">{title}</div> : null}
11+
<ul class="keyword-list">
12+
<slot />
13+
</ul>
14+
</section>
15+
16+
<style>
17+
.keyword-column {
18+
display: flex;
19+
flex-direction: column;
20+
gap: 0.5rem;
21+
min-width: 0;
22+
margin-top: 0;
23+
}
24+
25+
.keyword-column-title {
26+
font-weight: 600;
27+
}
28+
29+
.keyword-list {
30+
list-style: none;
31+
padding: 0;
32+
margin: 0;
33+
display: flex;
34+
flex-direction: column;
35+
gap: 0.35rem;
36+
}
37+
38+
.keyword-list :global(code) {
39+
font-family: var(--sl-font-mono, ui-monospace, SFMono-Regular, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);
40+
font-size: 0.95em;
41+
}
42+
</style>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
interface Props {
3+
columns?: number;
4+
}
5+
6+
const { columns = 3 } = Astro.props;
7+
---
8+
9+
<div class="keyword-grid" style={`--keyword-grid-columns: ${columns};`}>
10+
<slot />
11+
</div>
12+
13+
<style>
14+
.keyword-grid {
15+
display: grid;
16+
grid-template-columns: repeat(var(--keyword-grid-columns), minmax(0, 1fr));
17+
gap: 1.25rem;
18+
border: 1px solid var(--sl-color-gray-5);
19+
border-radius: 4px;
20+
padding: 1rem;
21+
}
22+
23+
@media (max-width: 900px) {
24+
.keyword-grid {
25+
grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
26+
}
27+
}
28+
</style>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import KeywordColumn from "@components/keyword-table/KeywordColumn.astro";
2+
import KeywordGrid from "@components/keyword-table/KeywordGrid.astro";
3+
4+
export { KeywordColumn, KeywordGrid };

0 commit comments

Comments
 (0)