generated from chiffre-io/template-library
-
-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Update to useRouter from next/navigation
Closes: #327
- Loading branch information
1 parent
3920763
commit a604351
Showing
27 changed files
with
1,114 additions
and
954 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
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,10 @@ | ||
import { defineConfig } from 'cypress' | ||
|
||
export default defineConfig({ | ||
e2e: { | ||
baseUrl: 'http://localhost:3000', | ||
video: false, | ||
fixturesFolder: false, | ||
supportFile: false | ||
} | ||
}) |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
integration/examples/ | ||
e2e/examples/ | ||
plugins/ | ||
screenshots/ | ||
support/ | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Next.js pages for E2E tests | ||
|
||
The Next.js app pages here are dedicated to end-to-end tests with Cypress. | ||
|
||
Check out the spec files in `/cypress/e2e` |
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,11 @@ | ||
'use client' | ||
|
||
import React from 'react' | ||
|
||
export default function RootLayout({ children }: { children: React.ReactNode }) { | ||
return ( | ||
<html> | ||
<body>{children}</body> | ||
</html> | ||
) | ||
} |
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,79 @@ | ||
'use client' | ||
|
||
import React from 'react' | ||
import { queryTypes, useQueryState } from './../../../../../' | ||
|
||
const IntegrationPage = () => { | ||
const [string, setString] = useQueryState('string') | ||
const [int, setInt] = useQueryState('int', queryTypes.integer) | ||
const [float, setFloat] = useQueryState('float', queryTypes.float) | ||
const [bool, setBool] = useQueryState('bool', queryTypes.boolean) | ||
return ( | ||
<main> | ||
<h1>useQueryState</h1> | ||
<section> | ||
<h2>String</h2> | ||
<button id="string_set_a" onClick={() => setString('a')}> | ||
Set A | ||
</button> | ||
<button id="string_set_b" onClick={() => setString('b')}> | ||
Set B | ||
</button> | ||
<button id="string_clear" onClick={() => setString(null)}> | ||
Clear | ||
</button> | ||
<p id="string_value">{string}</p> | ||
</section> | ||
<section> | ||
<h2>Integer</h2> | ||
<button | ||
id="int_increment" | ||
onClick={() => setInt(old => (old ?? 0) + 1)} | ||
> | ||
Increment | ||
</button> | ||
<button | ||
id="int_decrement" | ||
onClick={() => setInt(old => (old ?? 0) - 1)} | ||
> | ||
Decrement | ||
</button> | ||
<button id="int_clear" onClick={() => setInt(null)}> | ||
Clear | ||
</button> | ||
<p id="int_value">{int}</p> | ||
</section> | ||
<section> | ||
<h2>Float</h2> | ||
<button | ||
id="float_increment" | ||
onClick={() => setFloat(old => (old ?? 0) + 0.1)} | ||
> | ||
Increment by 0.1 | ||
</button> | ||
<button | ||
id="float_decrement" | ||
onClick={() => setFloat(old => (old ?? 0) - 0.1)} | ||
> | ||
Decrement by 0.1 | ||
</button> | ||
<button id="float_clear" onClick={() => setFloat(null)}> | ||
Clear | ||
</button> | ||
<p id="float_value">{float}</p> | ||
</section> | ||
<section> | ||
<h2>Boolean</h2> | ||
<button id="bool_toggle" onClick={() => setBool(old => !old)}> | ||
Toggle | ||
</button> | ||
<button id="bool_clear" onClick={() => setBool(null)}> | ||
Clear | ||
</button> | ||
<p id="bool_value">{bool === null ? null : bool ? 'true' : 'false'}</p> | ||
</section> | ||
</main> | ||
) | ||
} | ||
|
||
export default IntegrationPage |
5 changes: 3 additions & 2 deletions
5
src/pages/useQueryState/index.tsx → src/app/useQueryState/page.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
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,51 @@ | ||
'use client' | ||
|
||
import React from 'react' | ||
import { queryTypes, useQueryStates } from './../../../../../' | ||
|
||
const IntegrationPage = () => { | ||
const [state, setState] = useQueryStates({ | ||
string: queryTypes.string, | ||
int: queryTypes.integer, | ||
float: queryTypes.float, | ||
bool: queryTypes.boolean | ||
}) | ||
return ( | ||
<> | ||
<button onClick={() => setState({ string: 'Hello' })}>Set string</button> | ||
<button onClick={() => setState({ int: 42 })}>Set int</button> | ||
<button onClick={() => setState({ float: 3.14159 })}>Set float</button> | ||
<button onClick={() => setState(old => ({ bool: !old.bool }))}> | ||
Toggle bool | ||
</button> | ||
<button | ||
id="clear-string" | ||
onClick={() => setState(() => ({ string: null }))} | ||
> | ||
Clear string | ||
</button> | ||
<button | ||
id="clear" | ||
onClick={() => | ||
setState(() => ({ | ||
string: null, | ||
int: null, | ||
float: null, | ||
bool: null | ||
})) | ||
} | ||
> | ||
Clear | ||
</button> | ||
<p id="json">{JSON.stringify(state)}</p> | ||
<p id="string">{state.string}</p> | ||
<p id="int">{state.int}</p> | ||
<p id="float">{state.float}</p> | ||
<p id="bool"> | ||
{state.bool === null ? null : state.bool ? 'true' : 'false'} | ||
</p> | ||
</> | ||
) | ||
} | ||
|
||
export default IntegrationPage |
5 changes: 3 additions & 2 deletions
5
src/pages/useQueryStates/index.tsx → src/app/useQueryStates/page.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
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.