From 31399f86590ead987327735444583877e5e158fd Mon Sep 17 00:00:00 2001 From: Nathan Totten Date: Thu, 6 Nov 2025 14:51:10 -0500 Subject: [PATCH] Use css variables and tailwind styles in custom components --- .../step-2-add-rate-limiting-local.mdx | 2 +- .../step-3-add-api-key-auth-local.mdx | 2 +- scripts/generate-cli-docs.ts | 3 +- src/BrowserScreenshot.tsx | 165 +++--------------- src/BundlesTable.tsx | 25 +-- src/CliCommand.tsx | 20 +-- src/CopyPrompt.tsx | 8 +- src/LandingPage.tsx | 4 +- src/ModalScreenshot.tsx | 89 +--------- src/TutorialModeSelector.tsx | 20 +-- src/components.tsx | 6 +- src/zudoku-env.d.ts | 5 + 12 files changed, 77 insertions(+), 272 deletions(-) diff --git a/docs/articles/step-2-add-rate-limiting-local.mdx b/docs/articles/step-2-add-rate-limiting-local.mdx index 5db825585..3361bee35 100644 --- a/docs/articles/step-2-add-rate-limiting-local.mdx +++ b/docs/articles/step-2-add-rate-limiting-local.mdx @@ -64,7 +64,7 @@ limiter. 1. Add the rate-limiting Policy Open the local **Route Designer** by navigating to http://localhost:9100/. - Select your route and click **Add Policy** on the incoming Requeset policies + Select your route and click **Add Policy** on the incoming Request policies section. diff --git a/docs/articles/step-3-add-api-key-auth-local.mdx b/docs/articles/step-3-add-api-key-auth-local.mdx index 8d52d1baf..dab7a1d2d 100644 --- a/docs/articles/step-3-add-api-key-auth-local.mdx +++ b/docs/articles/step-3-add-api-key-auth-local.mdx @@ -61,7 +61,7 @@ Let's get started. 1. Add the API Key Authentication Policy Open the local **Route Designer** by navigating to http://localhost:9100/. - Select your route and click **Add Policy** on the incoming Requeset policies + Select your route and click **Add Policy** on the incoming Request policies section. diff --git a/scripts/generate-cli-docs.ts b/scripts/generate-cli-docs.ts index b89557989..15172c0fe 100644 --- a/scripts/generate-cli-docs.ts +++ b/scripts/generate-cli-docs.ts @@ -266,7 +266,8 @@ async function createCommandPage( } if (command.usage) { - props.push(formatJsxProp("usage", command.usage)); + // Wrap long usage commands for better readability + props.push(formatJsxProp("usage", wrapCliCommand(command.usage))); } // Get custom content from partial files diff --git a/src/BrowserScreenshot.tsx b/src/BrowserScreenshot.tsx index 912cb1339..564836f0f 100644 --- a/src/BrowserScreenshot.tsx +++ b/src/BrowserScreenshot.tsx @@ -1,12 +1,7 @@ -import type { CSSProperties, PropsWithChildren, ReactElement } from "react"; +import type { PropsWithChildren, ReactElement } from "react"; interface BrowserScreenshotProps { url?: string; - browserTheme?: "light" | "dark"; - browserShadow?: string; - borderRadius?: number; - className?: string; - style?: CSSProperties; size?: "sm" | "md" | "lg"; } @@ -19,144 +14,33 @@ const marginClasses = { export function BrowserScreenshot({ children, url = "https://example.com", - browserTheme = "light", - browserShadow = "0 10px 40px rgba(0, 0, 0, 0.08), 0 2px 10px rgba(0, 0, 0, 0.04)", - borderRadius = 8, - className = "", - style, size, }: PropsWithChildren): ReactElement { - const isDark = browserTheme === "dark"; - - const browserWindowStyle: CSSProperties = { - borderRadius: `${borderRadius}px`, - overflow: "hidden", - boxShadow: browserShadow, - backgroundColor: isDark ? "#1a1a1a" : "#fafafa", - border: `1px solid ${isDark ? "rgba(255, 255, 255, 0.12)" : "rgba(0, 0, 0, 0.12)"}`, - margin: "0 auto", - maxWidth: "90%", - ...style, - }; - - const browserBarStyle: CSSProperties = { - height: "40px", - backgroundColor: isDark ? "#262626" : "#f6f6f6", - display: "flex", - alignItems: "center", - padding: "0 16px", - gap: "16px", - position: "relative" as const, - }; - - const trafficLightStyle: CSSProperties = { - display: "flex", - gap: "8px", - alignItems: "center", - }; - - const dotStyle: CSSProperties = { - width: "12px", - height: "12px", - borderRadius: "50%", - }; - - const navigationStyle: CSSProperties = { - display: "flex", - gap: "16px", - alignItems: "center", - }; - - const navButtonStyle: CSSProperties = { - width: "14px", - height: "14px", - display: "flex", - alignItems: "center", - justifyContent: "center", - cursor: "pointer", - opacity: 0.6, - }; - - const urlBarStyle: CSSProperties = { - flex: 1, - maxWidth: "320px", - height: "28px", - backgroundColor: isDark ? "#1a1a1a" : "#fafafa", - border: `1px solid ${isDark ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.1)"}`, - borderRadius: "20px", - padding: "0 12px", - display: "flex", - alignItems: "center", - justifyContent: "center", - fontSize: "13px", - color: isDark ? "#888888" : "#666666", - fontFamily: - "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif", - }; - - const contentStyle: CSSProperties = { - backgroundColor: "#ffffff", - display: "block", - }; - - const marginClass = size - ? marginClasses[size] - ? marginClasses[size] - : "mx-auto" - : "mx-auto"; + const marginClass = size ? (marginClasses[size] ?? "mx-auto") : "mx-auto"; return (
p]:m-0 [&>p]:p-0 [&>p>img]:m-0 [&>p>img]:p-0 my-8 ${marginClass}`} > -
-