Files
blitzkit/packages/website-ue/src/components/ApiMacroSee.astro
T

36 lines
673 B
Plaintext
Raw Normal View History

2026-03-19 13:26:34 -05:00
---
2026-03-19 17:17:23 -05:00
import { sluggify } from "@blitzkit/core";
2026-03-19 18:44:00 -05:00
import { Code } from "./Code";
2026-03-19 13:26:34 -05:00
import { Link } from "./Link";
import { Text } from "./Text";
interface Props {
value: string;
2026-03-19 17:17:23 -05:00
locale: string;
2026-03-19 13:26:34 -05:00
}
2026-03-19 18:44:00 -05:00
const bodyPattern = /^([a-z0-9-\/\.\[\]]+) (.+)$/;
2026-03-19 17:17:23 -05:00
const { value, locale } = Astro.props;
2026-03-19 13:26:34 -05:00
const match = value.match(bodyPattern);
if (match === null) {
throw new Error(`Invalid value for ApiMacroSee: ${value}`);
}
const path = match[1];
const message = match[2];
---
2026-03-19 17:17:23 -05:00
<Text>
2026-03-19 18:44:00 -05:00
<Text lowContrast weight="medium" color="tomato">
<Code>@see</Code>
</Text>
<Link underline="never" href={`#${sluggify(path)}`}>
<Code>{path}</Code>
</Link>
{message}
2026-03-19 17:17:23 -05:00
</Text>