Skip to content

Commit bdc0e21

Browse files
committed
feat: add component NamedReq
1 parent a7a5181 commit bdc0e21

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

src/components/NamedReq.astro

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
import DocLink from "./DocLink.astro";
3+
4+
interface Props {
5+
name: string;
6+
bold?: boolean;
7+
displayName?: string;
8+
nolink?: boolean;
9+
}
10+
11+
const { name, bold, displayName, nolink } = Astro.props;
12+
const src = `/cpp/named_req/${name}`;
13+
14+
const text = displayName ?? name;
15+
16+
const As = nolink ? Fragment : DocLink;
17+
const asProps = nolink ? {} : { src };
18+
---
19+
20+
<As {...asProps}>
21+
<span class=`named-req${bold ? "-bold" : ""}`>
22+
{text}
23+
</span>
24+
</As>
25+
26+
<style>
27+
.named-req {
28+
font-weight: normal;
29+
font-style: italic;
30+
font-family: Georgia, "DejaVu Serif", serif;
31+
}
32+
.named-req-bold {
33+
font-weight: bold;
34+
font-style: italic;
35+
font-family: Georgia, "DejaVu Serif", serif;
36+
}
37+
</style>

0 commit comments

Comments
 (0)