Skip to content

Commit 8be1996

Browse files
committed
Make share preview use full width/height
1 parent bc880ca commit 8be1996

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

app/share/[id]/layout.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,5 @@ export default function Layout({
33
}: Readonly<{
44
children: React.ReactNode;
55
}>) {
6-
return (
7-
<body className="flex min-h-full flex-col items-center justify-center">
8-
{children}
9-
</body>
10-
);
6+
return <body className="flex min-h-full flex-col">{children}</body>;
117
}

components/code-viewer.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.sp-preview-container {
2+
@apply flex h-full w-full grow flex-col justify-center;
3+
}
4+
5+
.sp-preview-iframe {
6+
@apply grow;
7+
}

components/code-viewer.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
} from "@codesandbox/sandpack-react/unstyled";
99
import { dracula as draculaTheme } from "@codesandbox/sandpack-themes";
1010
import dedent from "dedent";
11+
import "./code-viewer.css";
1112

1213
export default function CodeViewer({
1314
code,
@@ -36,10 +37,12 @@ export default function CodeViewer({
3637
"App.tsx": code,
3738
...sharedFiles,
3839
}}
40+
className="flex h-full w-full grow flex-col justify-center"
3941
options={{ ...sharedOptions }}
4042
{...sharedProps}
4143
>
4244
<SandpackPreview
45+
className="flex h-full w-full grow flex-col justify-center p-4 md:pt-16"
4346
showOpenInCodeSandbox={false}
4447
showRefreshButton={false}
4548
/>

0 commit comments

Comments
 (0)