Skip to content

Commit

Permalink
feat: Add new background property to docs Frame component (#819)
Browse files Browse the repository at this point in the history
  • Loading branch information
KenzoBenzo authored May 7, 2024
1 parent 37455f8 commit db56984
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/ui/app/src/mdx/base-components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export const Image: FC<ImgProps> = ({ className, src, height, width, disableZoom
}, [files, src]);

return (
<Zoom zoomImg={{ src: fernImageSrc?.url }}>
<Zoom zoomImg={{ src: fernImageSrc?.url }} classDialog="custom-backdrop">
<FernImage src={fernImageSrc} {...rest} />
</Zoom>
);
Expand Down
10 changes: 8 additions & 2 deletions packages/ui/app/src/mdx/components/Frame.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
import clsx from "clsx";
import { FC, PropsWithChildren } from "react";

export declare namespace Frame {
export interface Props {
caption?: string;
background?: "default" | "subtle";
}
}

export const Frame: FC<PropsWithChildren<Frame.Props>> = ({ caption, children }) => {
export const Frame: FC<PropsWithChildren<Frame.Props>> = ({ caption, background = "default", children }) => {
return (
<figure className="not-prose fern-card relative mb-6 mt-4 overflow-hidden rounded-xl p-2 first:mt-0">
<figure
className={clsx("not-prose fern-card relative mb-6 mt-4 overflow-hidden rounded-xl p-2 first:mt-0", {
"bg-tag-default-soft": background === "subtle",
})}
>
<div className="relative flex justify-center overflow-hidden rounded-lg shadow-sm">{children}</div>
{caption && (
<figcaption className="t-muted relative mt-3 flex justify-center px-8 pb-2 pt-0 text-sm">
Expand Down
6 changes: 5 additions & 1 deletion packages/ui/app/src/next-app/globals.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
-webkit-tap-highlight-color: transparent;
}

/*
/*
html.dark {
background-color: var(--accent);
} */
Expand Down Expand Up @@ -821,4 +821,8 @@
.fern-api-property-key {
@apply font-mono t-default font-semibold text-sm;
}

.custom-backdrop [data-rmiz-modal-overlay="visible"] {
@apply bg-text-default/20;
}
}

0 comments on commit db56984

Please sign in to comment.