From fd28915e1b415cf2dc68d983d0595b355a639f35 Mon Sep 17 00:00:00 2001 From: Aral Roca Date: Sun, 15 Dec 2024 21:39:00 +0100 Subject: [PATCH 1/3] feat(example): add SSR dialog control example --- examples/with-ssr-modal/.gitignore | 4 + examples/with-ssr-modal/README.md | 7 + examples/with-ssr-modal/bunfig.toml | 2 + examples/with-ssr-modal/package.json | 19 ++ .../with-ssr-modal/src/components/footer.tsx | 19 ++ .../src/components/navigation.tsx | 25 ++ examples/with-ssr-modal/src/layout/index.tsx | 36 +++ .../with-ssr-modal/src/pages/about/index.tsx | 119 ++++++++ examples/with-ssr-modal/src/pages/index.tsx | 79 ++++++ examples/with-ssr-modal/src/public/brisa.svg | 10 + examples/with-ssr-modal/src/styles/footer.css | 8 + examples/with-ssr-modal/src/styles/nav.css | 46 +++ examples/with-ssr-modal/src/styles/style.css | 266 ++++++++++++++++++ examples/with-ssr-modal/tsconfig.json | 27 ++ 14 files changed, 667 insertions(+) create mode 100644 examples/with-ssr-modal/.gitignore create mode 100644 examples/with-ssr-modal/README.md create mode 100644 examples/with-ssr-modal/bunfig.toml create mode 100644 examples/with-ssr-modal/package.json create mode 100644 examples/with-ssr-modal/src/components/footer.tsx create mode 100644 examples/with-ssr-modal/src/components/navigation.tsx create mode 100644 examples/with-ssr-modal/src/layout/index.tsx create mode 100644 examples/with-ssr-modal/src/pages/about/index.tsx create mode 100644 examples/with-ssr-modal/src/pages/index.tsx create mode 100644 examples/with-ssr-modal/src/public/brisa.svg create mode 100644 examples/with-ssr-modal/src/styles/footer.css create mode 100644 examples/with-ssr-modal/src/styles/nav.css create mode 100644 examples/with-ssr-modal/src/styles/style.css create mode 100644 examples/with-ssr-modal/tsconfig.json diff --git a/examples/with-ssr-modal/.gitignore b/examples/with-ssr-modal/.gitignore new file mode 100644 index 000000000..6680baa7b --- /dev/null +++ b/examples/with-ssr-modal/.gitignore @@ -0,0 +1,4 @@ +build +node_modules +out +.vercel diff --git a/examples/with-ssr-modal/README.md b/examples/with-ssr-modal/README.md new file mode 100644 index 000000000..59042885e --- /dev/null +++ b/examples/with-ssr-modal/README.md @@ -0,0 +1,7 @@ +# with-ssr-modal + +Example controlling the open/close rendering of a modal with server code only (server action + SSR with streaming). + +```bash +bun create brisa --example with-ssr-modal +``` diff --git a/examples/with-ssr-modal/bunfig.toml b/examples/with-ssr-modal/bunfig.toml new file mode 100644 index 000000000..69803a7a9 --- /dev/null +++ b/examples/with-ssr-modal/bunfig.toml @@ -0,0 +1,2 @@ +[test] +preload = "brisa/test" \ No newline at end of file diff --git a/examples/with-ssr-modal/package.json b/examples/with-ssr-modal/package.json new file mode 100644 index 000000000..b35bd66ac --- /dev/null +++ b/examples/with-ssr-modal/package.json @@ -0,0 +1,19 @@ +{ + "name": "with-ssr-modal", + "module": "src/pages/index.tsx", + "type": "module", + "example-category": "basics", + "scripts": { + "dev": "brisa dev", + "dev:debug": "brisa dev --debug", + "build": "brisa build", + "start": "brisa start" + }, + "dependencies": { + "brisa": "0.2.1-canary.2" + }, + "devDependencies": { + "@types/bun": "latest", + "typescript": "latest" + } +} diff --git a/examples/with-ssr-modal/src/components/footer.tsx b/examples/with-ssr-modal/src/components/footer.tsx new file mode 100644 index 000000000..d61deb5f8 --- /dev/null +++ b/examples/with-ssr-modal/src/components/footer.tsx @@ -0,0 +1,19 @@ +export default function Footer() { + return ( + + ); +} diff --git a/examples/with-ssr-modal/src/components/navigation.tsx b/examples/with-ssr-modal/src/components/navigation.tsx new file mode 100644 index 000000000..eb11e0eb8 --- /dev/null +++ b/examples/with-ssr-modal/src/components/navigation.tsx @@ -0,0 +1,25 @@ +export default function Nav() { + return ( + + ); +} diff --git a/examples/with-ssr-modal/src/layout/index.tsx b/examples/with-ssr-modal/src/layout/index.tsx new file mode 100644 index 000000000..65a4edb6c --- /dev/null +++ b/examples/with-ssr-modal/src/layout/index.tsx @@ -0,0 +1,36 @@ +import Nav from '@/components/navigation'; +import Footer from '@/components/footer'; + +import '@/styles/style.css'; +import '@/styles/nav.css'; +import '@/styles/footer.css'; + +export default function Layout({ children }: { children: JSX.Element }) { + return ( + + + Brisa + + + + + + + + +
+
+
{children}
+