-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
184 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...c-external-packages/web/src/AboutPage.tsx → ...rsa/web/src/pages/AboutPage/AboutPage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 9 additions & 2 deletions
11
__fixtures__/test-project-rsc-external-packages/web/src/App.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
__fixtures__/test-project-rsc-external-packages/web/src/components/Counter/AboutCounter.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use client' | ||
|
||
import React from 'react' | ||
|
||
// @ts-expect-error no types | ||
import styles from './Counter.module.css' | ||
import './Counter.css' | ||
|
||
export const AboutCounter = () => { | ||
const [count, setCount] = React.useState(0) | ||
|
||
return ( | ||
<div style={{ border: '3px blue dashed', margin: '1em', padding: '1em' }}> | ||
<p>Count: {count}</p> | ||
<button onClick={() => setCount((c) => c + 1)}>Increment</button> | ||
<h3 className={styles.header}>This is a client component.</h3> | ||
<p>RSC on client: {globalThis.RWJS_EXP_RSC ? 'enabled' : 'disabled'}</p> | ||
</div> | ||
) | ||
} |
7 changes: 7 additions & 0 deletions
7
__fixtures__/test-project-rsc-external-packages/web/src/components/Counter/Counter.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/** | ||
* This should affect all h3 elements on the page, both server components and | ||
* client components. This is just standard CSS stuff | ||
*/ | ||
h3 { | ||
color: orange; | ||
} |
3 changes: 3 additions & 0 deletions
3
...xtures__/test-project-rsc-external-packages/web/src/components/Counter/Counter.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.header { | ||
font-style: italic; | ||
} |
21 changes: 21 additions & 0 deletions
21
__fixtures__/test-project-rsc-external-packages/web/src/components/Counter/Counter.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use client' | ||
|
||
import React from 'react' | ||
|
||
import 'client-only' | ||
|
||
// @ts-expect-error no types | ||
import styles from './Counter.module.css' | ||
import './Counter.css' | ||
|
||
export const Counter = () => { | ||
const [count, setCount] = React.useState(0) | ||
|
||
return ( | ||
<div style={{ border: '3px blue dashed', margin: '1em', padding: '1em' }}> | ||
<p>Count: {count}</p> | ||
<button onClick={() => setCount((c) => c + 1)}>Increment</button> | ||
<h3 className={styles.header}>This is a client component.</h3> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
__fixtures__/test-project-rsc-external-packages/web/src/pages/AboutPage/AboutPage.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.about-page { | ||
} |
27 changes: 27 additions & 0 deletions
27
__fixtures__/test-project-rsc-external-packages/web/src/pages/AboutPage/AboutPage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Assets } from '@redwoodjs/vite/assets' | ||
import { ProdRwRscServerGlobal } from '@redwoodjs/vite/rwRscGlobal' | ||
|
||
import { AboutCounter } from '../../components/Counter/AboutCounter' | ||
|
||
import './AboutPage.css' | ||
|
||
// TODO (RSC) Something like this will probably be needed | ||
// const RwRscGlobal = import.meta.env.PROD ? ProdRwRscServerGlobal : DevRwRscServerGlobal; | ||
|
||
globalThis.rwRscGlobal = new ProdRwRscServerGlobal() | ||
|
||
const AboutPage = () => { | ||
return ( | ||
<div className="about-page"> | ||
{/* TODO (RSC) <Assets /> should be part of the router later */} | ||
<Assets /> | ||
<div style={{ border: '3px red dashed', margin: '1em', padding: '1em' }}> | ||
<h1>About Redwood</h1> | ||
<AboutCounter /> | ||
<p>RSC on server: {globalThis.RWJS_EXP_RSC ? 'enabled' : 'disabled'}</p> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default AboutPage |
2 changes: 2 additions & 0 deletions
2
__fixtures__/test-project-rsc-external-packages/web/src/pages/HomePage/HomePage.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.home-page { | ||
} |
3 changes: 3 additions & 0 deletions
3
__fixtures__/test-project-rsc-external-packages/web/src/pages/HomePage/HomePage.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.title { | ||
color: green; | ||
} |
32 changes: 32 additions & 0 deletions
32
__fixtures__/test-project-rsc-external-packages/web/src/pages/HomePage/HomePage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { RscForm } from '@tobbe.dev/rsc-test' | ||
|
||
import { Assets } from '@redwoodjs/vite/assets' | ||
import { ProdRwRscServerGlobal } from '@redwoodjs/vite/rwRscGlobal' | ||
|
||
import { Counter } from '../../components/Counter/Counter' | ||
import { onSend } from './actions' | ||
// @ts-expect-error no types | ||
import styles from './HomePage.module.css' | ||
|
||
import './HomePage.css' | ||
|
||
// TODO (RSC) Something like this will probably be needed | ||
// const RwRscGlobal = import.meta.env.PROD ? ProdRwRscServerGlobal : DevRwRscServerGlobal; | ||
|
||
globalThis.rwRscGlobal = new ProdRwRscServerGlobal() | ||
|
||
const HomePage = ({ name = 'Anonymous' }) => { | ||
return ( | ||
<div className="home-page"> | ||
{/* TODO (RSC) <Assets /> should be part of the router later */} | ||
<Assets /> | ||
<div style={{ border: '3px red dashed', margin: '1em', padding: '1em' }}> | ||
<h1 className={styles.title}>Hello {name}!!</h1> | ||
<RscForm onSend={onSend} /> | ||
<Counter /> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default HomePage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/cli/src/commands/experimental/templates/rsc/AboutPage.tsx.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/cli/src/commands/experimental/templates/rsc/HomePage.tsx.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters