Skip to content

Commit

Permalink
Make share preview use full width/height
Browse files Browse the repository at this point in the history
  • Loading branch information
samselikoff committed Aug 12, 2024
1 parent bc880ca commit 8be1996
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 1 addition & 5 deletions app/share/[id]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,5 @@ export default function Layout({
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<body className="flex min-h-full flex-col items-center justify-center">
{children}
</body>
);
return <body className="flex min-h-full flex-col">{children}</body>;
}
7 changes: 7 additions & 0 deletions components/code-viewer.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.sp-preview-container {
@apply flex h-full w-full grow flex-col justify-center;
}

.sp-preview-iframe {
@apply grow;
}
3 changes: 3 additions & 0 deletions components/code-viewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} from "@codesandbox/sandpack-react/unstyled";
import { dracula as draculaTheme } from "@codesandbox/sandpack-themes";
import dedent from "dedent";
import "./code-viewer.css";

export default function CodeViewer({
code,
Expand Down Expand Up @@ -36,10 +37,12 @@ export default function CodeViewer({
"App.tsx": code,
...sharedFiles,
}}
className="flex h-full w-full grow flex-col justify-center"
options={{ ...sharedOptions }}
{...sharedProps}
>
<SandpackPreview
className="flex h-full w-full grow flex-col justify-center p-4 md:pt-16"
showOpenInCodeSandbox={false}
showRefreshButton={false}
/>
Expand Down

0 comments on commit 8be1996

Please sign in to comment.