Skip to content

Commit

Permalink
migrate /examples/file-structure-domain-driven/ to V1 design
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed May 20, 2023
1 parent b868506 commit 09c4741
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 25 deletions.
@@ -1,6 +1,6 @@
import React from 'react'
export default Page

export { Page }
import React from 'react'

function Page() {
return <>Login page</>
Expand Down
@@ -1,6 +1,6 @@
import React from 'react'
export default Page

export { Page }
import React from 'react'

function Page() {
return <>Signup page</>
Expand Down
3 changes: 3 additions & 0 deletions examples/file-structure-domain-driven-v1/marketing/+config.js
@@ -0,0 +1,3 @@
export default {
filesystemRoutingRoot: '/'
}

This file was deleted.

@@ -1,6 +1,6 @@
import React from 'react'
export default Page

export { Page }
import React from 'react'

function Page() {
return <>About page</>
Expand Down
@@ -1,6 +1,6 @@
import React from 'react'
export default Page

export { Page }
import React from 'react'

function Page() {
return <>Welcome</>
Expand Down
@@ -1,6 +1,6 @@
import React from 'react'
export default Page

export { Page }
import React from 'react'

function Page({ routeParams }) {
return <>Product {routeParams.productId}</>
Expand Down
@@ -1,6 +1,6 @@
import React from 'react'
export default Page

export { Page }
import React from 'react'

function Page() {
return (
Expand Down
@@ -1,5 +1,5 @@
export { prerender }
export default onBeforePrerenderStart

function prerender() {
function onBeforePrerenderStart() {
return [{ url: '/product/starship', url: '/product/mac-studio', url: '/product/แจ็คเก็ตเดนิม' }]
}
5 changes: 5 additions & 0 deletions examples/file-structure-domain-driven-v1/renderer/+config.js
@@ -0,0 +1,5 @@
export default {
clientRouting: true,
hydrationCanBeAborted: true,
passToClient: ['routeParams']
}
@@ -1,13 +1,11 @@
export { render }
export const clientRouting = true
export const hydrationCanBeAborted = true
export default onRenderClient

import React from 'react'
import ReactDOM from 'react-dom/client'
import { PageLayout } from './PageLayout'

let root
async function render(pageContext) {
async function onRenderClient(pageContext) {
const { Page, routeParams } = pageContext

const page = (
Expand Down
@@ -1,14 +1,11 @@
export default onRenderHtml

import ReactDOMServer from 'react-dom/server'
import React from 'react'
import { escapeInject, dangerouslySkipEscape } from 'vite-plugin-ssr/server'
import { PageLayout } from './PageLayout'

export { render }
export { passToClient }

const passToClient = ['routeParams']

function render(pageContext) {
function onRenderHtml(pageContext) {
const { Page, routeParams } = pageContext
const pageHtml = ReactDOMServer.renderToString(
<PageLayout>
Expand Down

0 comments on commit 09c4741

Please sign in to comment.