Files
medusa-store/www/apps/docs/src/theme/Admonition/Layout/index.tsx
T
Shahed Nasser c6dff873de docs: update docusaurus to v3 (#5625)
* update dependencies

* update onboarding mdx

* fixes for mdx issues

* fixes for mdx compatibility

* resolve mdx errors

* fixes in reference

* fix check errors

* revert change in vale action

* fix node version in action

* fix summary in markdown
2023-11-13 20:11:50 +02:00

52 lines
1.4 KiB
TypeScript

import React, { type ReactNode } from "react"
import clsx from "clsx"
import type { Props } from "@theme/Admonition/Layout"
function AdmonitionContainer({
className,
children,
}: Pick<Props, "type" | "className"> & { children: ReactNode }) {
return (
<div
className={clsx(
"p-1 border border-solid border-medusa-border-base rounded",
"bg-medusa-bg-subtle dark:bg-medusa-bg-base shadow-none",
"[&_a]:no-underline [&_a]:text-medusa-fg-interactive hover:[&_a]:text-medusa-fg-interactive-hover ",
"mb-2 alert",
className
)}
>
<div className={clsx("flex")}>{children}</div>
</div>
)
}
function AdmonitionHeading({ icon }: Pick<Props, "icon">) {
return <span className={clsx("inline-block h-1.5 w-1.5 mr-1")}>{icon}</span>
}
function AdmonitionContent({ children }: Pick<Props, "children">) {
return children ? (
<div
className={clsx(
"text-medusa-fg-subtle",
"text-medium flex-1 [&>*:last-child]:mb-0",
"[&>p>code]:px-0.5 [&>p>code]:text-code-label"
)}
>
{children}
</div>
) : null
}
export default function AdmonitionLayout(props: Props): JSX.Element {
const { type, icon, children, className } = props
return (
<AdmonitionContainer type={type} className={className}>
<AdmonitionHeading icon={icon} />
<AdmonitionContent>{children}</AdmonitionContent>
</AdmonitionContainer>
)
}