Skip to content

Commit

Permalink
merge /examples/streaming/ into /examples/basic/
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Apr 8, 2024
1 parent ac3346e commit 7c30b9d
Show file tree
Hide file tree
Showing 22 changed files with 30 additions and 310 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState } from 'react'

export { Counter }

import React, { useState } from 'react'

function Counter() {
const [count, setCount] = useState(0)
return (
Expand Down
1 change: 1 addition & 0 deletions examples/basic/layouts/LayoutDefault.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function LayoutDefault({ children }: { children: React.ReactNode }) {
<Logo />
<Link href="/">Welcome</Link>
<Link href="/star-wars">Data Fetching</Link>
<Link href="/streaming">HTML Streaming</Link>
</Sidebar>
<Content>{children}</Content>
</div>
Expand Down
8 changes: 8 additions & 0 deletions examples/basic/layouts/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,11 @@ body {
body.page-is-transitioning #page-content {
opacity: 0;
}

/* Inline code blocks */
code {
font-family: monospace;
background-color: #eaeaea;
padding: 3px 5px;
border-radius: 4px;
}
3 changes: 2 additions & 1 deletion examples/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"preview": "vite build && vite preview",
"test": "tsc --noEmit"
},
"dependencies": {
Expand All @@ -12,6 +12,7 @@
"node-fetch": "^3.3.2",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-streaming": "^0.3.22",
"typescript": "^5.3.3",
"vike": "^0.4.168",
"vike-react": "^0.4.6",
Expand Down
2 changes: 2 additions & 0 deletions examples/basic/pages/+config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ const config = {
Head: HeadDefault,
// <title>
title: 'My Vike + React App',
// Enable HTML streaming (https://vike.dev/stream)
stream: true,
extends: vikeReact
} satisfies Config
2 changes: 1 addition & 1 deletion examples/basic/pages/index/+Page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export default Page

import React from 'react'
import { Counter } from './Counter'
import { Counter } from '../../components/Counter'

function Page() {
return (
Expand Down
9 changes: 0 additions & 9 deletions examples/basic/pages/index/Counter.tsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
export default Page

import React, { Suspense, useState } from 'react'
import React, { Suspense } from 'react'
import { useAsync } from 'react-streaming'
import { Counter } from '../../components/Counter'

function Page() {
const [count, setCount] = useState(0)
return (
<>
<h1>Star Wars Movies</h1>
<p>
Same as <code>/star-wars</code> page, but showcasing <a href="https://vike.dev/streaming">HTML Streaming</a> and{' '}
<a href="https://vike.dev/streaming#progressive-rendering">Progressive Rendering</a> (note how the counter is
interactive before the data has finished loading).
</p>
<Counter />
<Suspense fallback={<p>Loading...</p>}>
<MovieList />
Expand Down
11 changes: 5 additions & 6 deletions examples/basic/readme.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
Basic example of using `vike-react`, showcasing:
Full-fledged example of using `vike-react`, showcasing:

* [layouts](https://vike.dev/layouts)
* rendering to `<head>`
* fetching data with [`data()`](https://vike.dev/data) hooks
* [configs](https://vike.dev/config)
* [error pages](https://vike.dev/error-page)
- [Layout](https://vike.dev/Layout)
- Fetching data with [`data()`](https://vike.dev/data)
- [Error page](https://vike.dev/error-page)
- [HTML Streaming](https://vike.dev/streaming)

```bash
git clone git@github.com:vikejs/vike-react
Expand Down
2 changes: 0 additions & 2 deletions examples/streaming/.gitignore

This file was deleted.

36 changes: 0 additions & 36 deletions examples/streaming/assets/logo.svg

This file was deleted.

15 changes: 0 additions & 15 deletions examples/streaming/components/Link.tsx

This file was deleted.

14 changes: 0 additions & 14 deletions examples/streaming/layouts/HeadDefault.tsx

This file was deleted.

74 changes: 0 additions & 74 deletions examples/streaming/layouts/LayoutDefault.tsx

This file was deleted.

29 changes: 0 additions & 29 deletions examples/streaming/layouts/style.css

This file was deleted.

21 changes: 0 additions & 21 deletions examples/streaming/package.json

This file was deleted.

14 changes: 0 additions & 14 deletions examples/streaming/pages/+config.ts

This file was deleted.

23 changes: 0 additions & 23 deletions examples/streaming/pages/_error/+Page.tsx

This file was deleted.

8 changes: 0 additions & 8 deletions examples/streaming/readme.md

This file was deleted.

13 changes: 0 additions & 13 deletions examples/streaming/tsconfig.json

This file was deleted.

7 changes: 0 additions & 7 deletions examples/streaming/vite.config.ts

This file was deleted.

Loading

0 comments on commit 7c30b9d

Please sign in to comment.