Skip to content

Commit

Permalink
chore: Demos layout
Browse files Browse the repository at this point in the history
  • Loading branch information
franky47 committed Sep 12, 2023
1 parent 3b22db1 commit 6c59d9c
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 13 deletions.
6 changes: 2 additions & 4 deletions src/app/demos/batching/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use client'

import Link from 'next/link'
import { useQueryState } from '../../../../dist'
import { parseAsFloat } from '../../../lib'

Expand All @@ -14,8 +13,7 @@ export default function BuilderPatternDemoPage() {
const lngStr = lng.toString().split('.')

return (
<main>
<Link href="/">⬅️ Home</Link>
<>
<h1>Batching</h1>
<button
onClick={async () => {
Expand All @@ -38,6 +36,6 @@ export default function BuilderPatternDemoPage() {
Lng {lngStr[0].padStart(4) + '.' + (lngStr[1] ?? '00')}
</code>
</pre>
</main>
</>
)
}
6 changes: 2 additions & 4 deletions src/app/demos/builder-pattern/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use client'

import Link from 'next/link'
import { parseAsInteger, useQueryState } from '../../../../dist'

export default function BuilderPatternDemoPage() {
Expand All @@ -16,8 +15,7 @@ export default function BuilderPatternDemoPage() {
)

return (
<main>
<Link href="/">⬅️ Home</Link>
<>
<h1>Builder pattern</h1>
<button onClick={() => setCounter(x => x - 1)}>-</button>
<button onClick={() => setCounter(x => x + 1)}>+</button>
Expand All @@ -29,6 +27,6 @@ export default function BuilderPatternDemoPage() {
enabled.
</em>
</p>
</main>
</>
)
}
1 change: 1 addition & 0 deletions src/app/demos/hex-colors/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default function HexColorsDemo() {
const asHex = '#' + hexColorSchema.serialize(color)
return (
<>
<h1>Hex colors</h1>
<section>
<div>
<label>Color</label>
Expand Down
18 changes: 18 additions & 0 deletions src/app/demos/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import Link from 'next/link'

export const metadata = {
title: 'next-usequerystate demos'
}

export default function DemoLayout({
children
}: {
children: React.ReactNode
}) {
return (
<main>
<Link href="/">⬅️ Home</Link>
{children}
</main>
)
}
1 change: 1 addition & 0 deletions src/app/demos/server-side-parsing/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default function ServerSideParsingDemo({ searchParams }: PageProps) {
console.log('Server side counter: %d', counter)
return (
<>
<h1>Server-side parsing</h1>
<Suspense>
<ServerSideParsingDemoClient serverSideCounter={counter}>
<p>Server rendered counter: {counter}</p>
Expand Down
8 changes: 3 additions & 5 deletions src/app/demos/subscribeToQueryUpdates/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use client'

import Link from 'next/link'
import React from 'react'
import {
parseAsInteger,
Expand All @@ -22,16 +21,15 @@ export default function BuilderPatternDemoPage() {
}, [])

return (
<main>
<Link href="/">⬅️ Home</Link>
<h1>subscribeToQueryUpdates</h1>
<>
<h1>Subscribing to query updates</h1>
<button onClick={() => setCounter(x => x - 1)}>-</button>
<button onClick={() => setCounter(x => x + 1)}>+</button>
<button onClick={() => setCounter(null)}>Reset</button>
<p>{counter}</p>
<p>
<em>Check the console</em>
</p>
</main>
</>
)
}

0 comments on commit 6c59d9c

Please sign in to comment.