docs: redesign tables (#8653)

* docs: redesign tables

* fixes
This commit is contained in:
Shahed Nasser
2024-08-20 15:47:36 +03:00
committed by GitHub
parent 73905c14b1
commit b8ba020cd5
33 changed files with 226 additions and 208 deletions

View File

@@ -0,0 +1,20 @@
import React from "react"
import clsx from "clsx"
import { CodeBlockProps } from "../../.."
export const CodeBlockInline = ({ source }: CodeBlockProps) => {
return (
<pre
className={clsx(
"px-[6px] bg-medusa-tag-neutral-bg",
"w-full my-docs_0.5 rounded-docs_sm",
"border border-medusa-tag-neutral-border",
"whitespace-pre-wrap"
)}
>
<code className="w-full text-code-label text-medusa-tag-neutral-text">
{source}
</code>
</pre>
)
}

View File

@@ -14,6 +14,7 @@ import { HighlightProps as CollapsibleHighlightProps } from "@/hooks"
import { CodeBlockActions, CodeBlockActionsProps } from "./Actions"
import { CodeBlockCollapsibleButton } from "./Collapsible/Button"
import { CodeBlockCollapsibleFade } from "./Collapsible/Fade"
import { CodeBlockInline } from "./Inline"
export type Highlight = {
line: number
@@ -41,7 +42,7 @@ export type CodeBlockMetaFields = {
isTerminal?: boolean
} & CodeBlockHeaderMeta
export type CodeBlockStyle = "loud" | "subtle"
export type CodeBlockStyle = "loud" | "subtle" | "inline"
export type CodeBlockProps = {
source: string
@@ -75,6 +76,9 @@ export const CodeBlock = ({
if (!source && typeof children === "string") {
source = children
}
if (blockStyle === "inline") {
return <CodeBlockInline source={source} />
}
const { colorMode } = useColorMode()
const [showTesting, setShowTesting] = useState(false)