From 7e3bca56cbea8b0d019e551e7564b0bb215c9e5b 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 --- scripts/generate-cli-docs.ts | 3 +- src/components.tsx | 6 +- src/components/BrowserScreenshot.tsx | 165 +++--------------------- src/components/BundlesTable.tsx | 25 ++-- src/components/CliCommand.tsx | 20 ++- src/components/CopyPrompt.tsx | 8 +- src/components/ModalScreenshot.tsx | 89 +------------ src/components/TutorialModeSelector.tsx | 20 ++- src/pages/LandingPage.tsx | 4 +- src/zudoku-env.d.ts | 5 + 10 files changed, 75 insertions(+), 270 deletions(-) diff --git a/scripts/generate-cli-docs.ts b/scripts/generate-cli-docs.ts index dfbfe082d..9d5c9f238 100644 --- a/scripts/generate-cli-docs.ts +++ b/scripts/generate-cli-docs.ts @@ -268,7 +268,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/components.tsx b/src/components.tsx index 725aaa27f..fc4a74a5e 100644 --- a/src/components.tsx +++ b/src/components.tsx @@ -61,7 +61,7 @@ export const mdxComponents = { ); @@ -69,13 +69,13 @@ export const mdxComponents = { return ( ); }, Framed, CodeType: (props: PropsWithChildren) => ( - <{props.children}> + <{props.children}> ), DocusaurusDocsLicense, GithubButton, diff --git a/src/components/BrowserScreenshot.tsx b/src/components/BrowserScreenshot.tsx index 912cb1339..564836f0f 100644 --- a/src/components/BrowserScreenshot.tsx +++ b/src/components/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}`} > -
-