Skip to content

Commit 82dbc9b

Browse files
harryhcsjustinvdm
authored andcommitted
add an iframe to starter page so it looks more refined (#660)
Update Document component and security headers - Added CSS module and module preload link to the Document component for iframe styling - Updated Content Security Policy in headers to allow frame ancestors from 'self' and local dev - Replaced static content in Home component with an iframe to load external start page.
1 parent 300898b commit 82dbc9b

File tree

5 files changed

+18
-4
lines changed

5 files changed

+18
-4
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@
1515
<a href="https://discord.gg/redwoodjs"><img alt="Join the community on Discord" src="https://img.shields.io/badge/Join%20the%20community-blueviolet.svg?style=for-the-badge&logo=Discord&labelColor=000000&logoWidth=20"></a>
1616
<a href="https://github.com/redwoodjs/sdk/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/github/license/redwoodjs/sdk?style=for-the-badge&labelColor=000000"></a>
1717

18+
1819
</div>
1920

2021
---
2122

23+
2224
## ✨ RedwoodSDK
2325

2426
**RedwoodSDK** is the missing React framework for Cloudflare — bringing SSR, React Server Components, Server Functions, and Realtime APIs to the edge with the power of [Vite](https://vitejs.dev/).

starters/minimal/src/app/Document.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import stylesUrl from "./styles.css?url";
12
export const Document: React.FC<{ children: React.ReactNode }> = ({
23
children,
34
}) => (
@@ -7,6 +8,7 @@ export const Document: React.FC<{ children: React.ReactNode }> = ({
78
<meta name="viewport" content="width=device-width, initial-scale=1" />
89
<title>@redwoodjs/starter-minimal</title>
910
<link rel="modulepreload" href="/src/client.tsx" />
11+
<link rel="stylesheet" href={stylesUrl} />
1012
</head>
1113
<body>
1214
<div id="root">{children}</div>

starters/minimal/src/app/headers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ export const setCommonHeaders =
2626
// Defines trusted sources for content loading and script execution:
2727
response.headers.set(
2828
"Content-Security-Policy",
29-
`default-src 'self'; script-src 'self' 'nonce-${nonce}' https://challenges.cloudflare.com; style-src 'self' 'unsafe-inline'; frame-src https://challenges.cloudflare.com; object-src 'none';`,
29+
`default-src 'self'; script-src 'self' 'nonce-${nonce}' https://challenges.cloudflare.com; style-src 'self' 'unsafe-inline'; frame-ancestors 'self'; frame-src 'self' https://challenges.cloudflare.com https://rwsdk.com; object-src 'none';`,
3030
);
3131
};

starters/minimal/src/app/pages/Home.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ import { RequestInfo } from "rwsdk/worker";
22

33
export function Home({ ctx }: RequestInfo) {
44
return (
5-
<div>
6-
<h1>Hello World</h1>
7-
</div>
5+
<iframe
6+
style={{ width: "100%", height: "100%", border: "none" }}
7+
src="https://rwsdk.com/start"
8+
/>
89
);
910
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
body {
2+
min-height: 100vh;
3+
padding: 0;
4+
}
5+
6+
#root, #hydrate-root {
7+
width: 100vw;
8+
height: 100vh;
9+
}

0 commit comments

Comments
 (0)