{copied ? (
-
+
Copied!
@@ -97,8 +131,8 @@ export default function CodeBlock({
}
- className="!p-1 !bg-transparent opacity-50"
+ beforeIcon={}
+ className="!p-1 !bg-transparent !text-(--twui-code-muted) hover:!text-(--twui-code-fg)"
onClick={() => {
const content =
codeRef.current?.textContent;
@@ -122,12 +156,12 @@ export default function CodeBlock({
{!singleBlock && (
-
+
)}
- {children}
+
+ {highlighted
+ ? highlighted.children.map((node, index) => (
+
+ ))
+ : children}
+
diff --git a/src/components/twui/mdx/mdx-components.tsx b/src/components/twui/mdx/mdx-components.tsx
index 2bd8a3c..3def67c 100644
--- a/src/components/twui/mdx/mdx-components.tsx
+++ b/src/components/twui/mdx/mdx-components.tsx
@@ -1,5 +1,5 @@
import { type MDXComponents } from "mdx/types";
-import CodeBlock from "../elements/CodeBlock";
+import CodeBlock, { type TWUICodeBlockTheme } from "../elements/CodeBlock";
import H1 from "../layout/H1";
import H4 from "../layout/H4";
import React from "react";
@@ -11,10 +11,12 @@ import H3 from "../layout/H3";
type Params = {
components: MDXComponents;
codeBgColor?: string;
+ codeTheme?: TWUICodeBlockTheme;
};
export function useMDXComponents(params?: Params) {
- const codeBgColor = params?.codeBgColor || "#000000";
+ const codeBgColor = params?.codeBgColor;
+ const codeTheme = params?.codeTheme;
return {
components: {
@@ -24,7 +26,9 @@ export function useMDXComponents(params?: Params) {
if (React.isValidElement(children) && children.props) {
return (
// @ts-ignore
-
+
{/* @ts-ignore */}
{children.props.children}
@@ -32,7 +36,9 @@ export function useMDXComponents(params?: Params) {
}
return (
// @ts-ignore
-
+
{children}
);
diff --git a/src/components/twui/next-js/hooks/useMDXComponents.tsx b/src/components/twui/next-js/hooks/useMDXComponents.tsx
index e719aee..5958834 100644
--- a/src/components/twui/next-js/hooks/useMDXComponents.tsx
+++ b/src/components/twui/next-js/hooks/useMDXComponents.tsx
@@ -4,17 +4,19 @@ import H1 from "../../layout/H1";
import H2 from "../../layout/H2";
import H3 from "../../layout/H3";
import H4 from "../../layout/H4";
-import CodeBlock from "../../elements/CodeBlock";
+import CodeBlock, { type TWUICodeBlockTheme } from "../../elements/CodeBlock";
import { twMerge } from "tailwind-merge";
type Params = {
components: MDXComponents;
codeBgColor?: string;
+ codeTheme?: TWUICodeBlockTheme;
};
export default function useMDXComponents({
components,
codeBgColor,
+ codeTheme,
}: Params): MDXComponents {
return {
h1: ({ children }) => {children}
,
@@ -23,7 +25,9 @@ export default function useMDXComponents({
if (React.isValidElement(children) && children.props) {
return (
// @ts-ignore
-
+
{/* @ts-ignore */}
{children.props.children}
@@ -31,7 +35,9 @@ export default function useMDXComponents({
}
return (
// @ts-ignore
-
+
{children}
);
diff --git a/src/components/twui/package.json b/src/components/twui/package.json
index 1b56ce5..6b15d0b 100644
--- a/src/components/twui/package.json
+++ b/src/components/twui/package.json
@@ -14,7 +14,8 @@
"next-mdx-remote": "latest",
"remark-gfm": "latest",
"rehype-prism-plus": "latest",
- "html-to-react": "^1.7.0"
+ "html-to-react": "^1.7.0",
+ "refractor": "latest"
},
"devDependencies": {
"@types/ace": "latest",
diff --git a/src/pages/admin/hosts/[host_id]/(sections)/host-interface-section.tsx b/src/pages/admin/hosts/[host_id]/(sections)/host-interface-section.tsx
index a565d36..b351b2f 100644
--- a/src/pages/admin/hosts/[host_id]/(sections)/host-interface-section.tsx
+++ b/src/pages/admin/hosts/[host_id]/(sections)/host-interface-section.tsx
@@ -30,7 +30,7 @@ export default function HostInterfaceSection({ host, clients }: Props) {
) : undefined
}
>
-
+
{buildInterfaceSummary({ config })}
diff --git a/src/pages/admin/hosts/[host_id]/clients/[client_id]/(partials)/client-config-panel.tsx b/src/pages/admin/hosts/[host_id]/clients/[client_id]/(partials)/client-config-panel.tsx
index 77fa869..ab0d7e2 100644
--- a/src/pages/admin/hosts/[host_id]/clients/[client_id]/(partials)/client-config-panel.tsx
+++ b/src/pages/admin/hosts/[host_id]/clients/[client_id]/(partials)/client-config-panel.tsx
@@ -29,7 +29,9 @@ export default function ClientConfigPanel() {
}
>
{config ? (
- {config}
+
+ {config}
+
) : (