mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 03:59:50 +02:00
feat: more decoration
This commit is contained in:
1 parent
c99ed0cb53
commit
b9bbf22f2c
6 files changed
+39
-20
No files matched your search
@@ -123,9 +123,11 @@
|
|||||||
"media": "Media methods",
|
"media": "Media methods",
|
||||||
"no_docs": "This method has no documentation.",
|
"no_docs": "This method has no documentation.",
|
||||||
"test": "Test",
|
"test": "Test",
|
||||||
|
"view_full": "View full types",
|
||||||
|
|
||||||
"macros": {
|
"macros": {
|
||||||
"see": "See {path} {message}"
|
"see": "See {path} {message}",
|
||||||
|
"types": "Types:"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,18 @@
|
|||||||
---
|
---
|
||||||
import { existsSync } from "fs";
|
import { existsSync } from "fs";
|
||||||
import { readFile } from "fs/promises";
|
import { readFile } from "fs/promises";
|
||||||
import HighlightedCode from "./HighlightedCode.astro";
|
|
||||||
import { Link } from "./Link";
|
import { Link } from "./Link";
|
||||||
|
import { api } from "../core/api/dynamic";
|
||||||
|
import HighlightedCodeBlock from "./HighlightedCodeBlock.astro";
|
||||||
|
import { Text } from "./Text";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
value: string;
|
value: string;
|
||||||
|
locale: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { value } = Astro.props;
|
const { value, locale } = Astro.props;
|
||||||
|
const strings = await api.strings(locale);
|
||||||
|
|
||||||
const roots = ["src/protos", "../closed/protos"];
|
const roots = ["src/protos", "../closed/protos"];
|
||||||
|
|
||||||
@@ -111,12 +115,16 @@ stripped = stripped.replaceAll(" ", " ");
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<Text>
|
||||||
|
{strings.api.macros.types}
|
||||||
|
</Text>
|
||||||
|
|
||||||
<div class="types">
|
<div class="types">
|
||||||
<HighlightedCode {lang} content={stripped} />
|
<HighlightedCodeBlock {lang} content={stripped} />
|
||||||
|
|
||||||
<div class="overlay">
|
<div class="overlay">
|
||||||
<Link underline="always" href="#" className="view-full">
|
<Link underline="always" href="#" className="view-full">
|
||||||
View full types
|
{strings.api.view_full}
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,4 +1,16 @@
|
|||||||
.code {
|
.code {
|
||||||
font: inherit;
|
font: inherit;
|
||||||
font-family: var(--font-family-mono);
|
font-family: var(--font-family-mono);
|
||||||
|
|
||||||
|
white-space: pre;
|
||||||
|
|
||||||
|
display: inline-block;
|
||||||
|
|
||||||
|
&[data-variant="solid"] {
|
||||||
|
background-color: var(--gray-3);
|
||||||
|
|
||||||
|
border-radius: var(--space-3);
|
||||||
|
|
||||||
|
padding: var(--space-4);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,8 +2,16 @@ import type { ComponentProps } from "react";
|
|||||||
import { classNames } from "../../core/ui/classNames";
|
import { classNames } from "../../core/ui/classNames";
|
||||||
import styles from "./index.module.css";
|
import styles from "./index.module.css";
|
||||||
|
|
||||||
export interface CodeProps extends ComponentProps<"code"> {}
|
export interface CodeProps extends ComponentProps<"code"> {
|
||||||
|
variant?: "ghost" | "solid";
|
||||||
|
}
|
||||||
|
|
||||||
export function Code({ className, ...props }: CodeProps) {
|
export function Code({ className, variant = "ghost", ...props }: CodeProps) {
|
||||||
return <code className={classNames(styles.code, className)} {...props} />;
|
return (
|
||||||
|
<code
|
||||||
|
data-variant={variant}
|
||||||
|
className={classNames(styles.code, className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
File renamed without changes.
@@ -13,16 +13,5 @@ export function HighlightedCodeContent({ tree }: Props) {
|
|||||||
? tree
|
? tree
|
||||||
: toJsxRuntime(tree, { Fragment, jsx, jsxs });
|
: toJsxRuntime(tree, { Fragment, jsx, jsxs });
|
||||||
|
|
||||||
return (
|
return <Code variant="solid" children={node} />;
|
||||||
<Code
|
|
||||||
style={{
|
|
||||||
overflow: "auto",
|
|
||||||
padding: "var(--space-3)",
|
|
||||||
display: "block",
|
|
||||||
whiteSpace: "pre",
|
|
||||||
lineHeight: "1.5em",
|
|
||||||
}}
|
|
||||||
children={node}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user