Skip to content

Commit 4a7582d

Browse files
committed
add max height to code preview for docs
1 parent 483df34 commit 4a7582d

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

widgets/code-preview.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ import React from "react";
22
import Link from "next/link";
33
import { useRouter } from "next/router";
44
import {
5-
Tabs,
6-
TabsHeader,
7-
Tab,
8-
Typography,
95
Tooltip,
106
IconButton,
117
Button,
@@ -15,14 +11,11 @@ import {
1511
MenuItem,
1612
} from "@material-tailwind/react";
1713
import {
18-
EyeIcon,
19-
CodeBracketIcon,
2014
ClipboardDocumentListIcon,
2115
ClipboardDocumentCheckIcon,
2216
ChevronDownIcon,
2317
} from "@heroicons/react/24/outline";
2418
import copyToClipboard from "utils/copy-to-clipboard";
25-
import { v4 as uuidv4 } from "uuid";
2619

2720
export function CodePreview({ id, component, link, children, className }) {
2821
const codeRef = React.useRef(null);
@@ -40,7 +33,7 @@ export function CodePreview({ id, component, link, children, className }) {
4033
return (
4134
<div
4235
id={id}
43-
className={`scroll-mt-64 rounded-xl border border-blue-gray-50 ${
36+
className={`scroll-mt-64 overflow-hidden rounded-xl border border-blue-gray-50 ${
4437
mode === "code" ? "bg-[#1e293b]" : "bg-[#f8fafc]"
4538
} ${className || ""}`}
4639
>
@@ -144,7 +137,7 @@ export function CodePreview({ id, component, link, children, className }) {
144137
<div className="grid min-h-[140px] w-full place-items-center overflow-x-scroll rounded-lg p-6 lg:overflow-visible">
145138
{component}
146139
</div>
147-
<div className="code-preview block">
140+
<div className="code-preview block max-h-[40rem] overflow-scroll rounded-b-xl">
148141
{React.cloneElement(children, { ref: codeRef })}
149142
</div>
150143
</div>

0 commit comments

Comments
 (0)