Skip to content

Commit 957eb11

Browse files
committed
chore: rename to ReactRouter6 adapter
1 parent b064b76 commit 957eb11

File tree

13 files changed

+19
-16
lines changed

13 files changed

+19
-16
lines changed

examples/react-router-6/src/index.css

+5-4
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,22 @@ nav {
1919
flex-wrap: wrap;
2020
gap: 12px;
2121
background: #eee;
22-
padding: 16px;
22+
padding: 0 16px;
2323
border-bottom: 1px solid #ddd;
2424
margin: -24px -24px 0;
2525
}
2626

2727
nav a {
28-
color: blue;
28+
color: black;
29+
font-weight: 600;
2930
text-decoration: none;
30-
padding: 2px 4px;
31+
padding: 12px 12px;
3132
display: inline-block;
3233
}
3334

3435
a.active {
3536
color: rgb(179, 32, 93);
36-
background-color: rgb(242, 228, 234);
37+
background-color: white;
3738
}
3839

3940
nav a:hover {

examples/react-router-6/src/index.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import ReactDOM from 'react-dom/client';
33
import './index.css';
44
import App from './App';
55
import { QueryParamProvider } from 'use-query-params';
6-
import { ReactRouterAdapter } from 'use-query-params/adapters/react-router';
7-
import { BrowserRouter, Route, Routes } from 'react-router-dom';
6+
import { ReactRouter6Adapter } from 'use-query-params/adapters/react-router-6';
7+
import { BrowserRouter, Route, Routes, Navigate } from 'react-router-dom';
88
import UseQueryParamExample from './UseQueryParamExample';
99
import UseQueryParamsExample from './UseQueryParamsExample';
1010
// optionally use the query-string parse / stringify functions to
@@ -18,14 +18,15 @@ root.render(
1818
<React.StrictMode>
1919
<BrowserRouter>
2020
<QueryParamProvider
21-
adapter={ReactRouterAdapter}
21+
adapter={ReactRouter6Adapter}
2222
options={{
2323
searchStringToObject: parse,
2424
objectToSearchString: stringify,
2525
}}
2626
>
2727
<Routes>
2828
<Route path="/" element={<App />}>
29+
<Route index element={<Navigate to="/useQueryParams" replace />} />
2930
<Route path="useQueryParam" element={<UseQueryParamExample />} />
3031
<Route path="useQueryParams" element={<UseQueryParamsExample />} />
3132
</Route>

examples/website-example/src/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import ReactDOM from 'react-dom/client';
33
import './index.css';
44
import App from './App';
55
import { QueryParamProvider } from 'use-query-params';
6-
import { ReactRouterAdapter } from 'use-query-params/adapters/react-router';
6+
import { ReactRouter6Adapter } from 'use-query-params/adapters/react-router-6';
77
import { BrowserRouter, Route, Routes } from 'react-router-dom';
88
// optionally use the query-string parse / stringify functions to
99
// handle more advanced cases than URLSearchParams supports.
@@ -16,7 +16,7 @@ root.render(
1616
<React.StrictMode>
1717
<BrowserRouter>
1818
<QueryParamProvider
19-
adapter={ReactRouterAdapter}
19+
adapter={ReactRouter6Adapter}
2020
options={{
2121
searchStringToObject: parse,
2222
objectToSearchString: stringify,

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@
4848
},
4949
"scripts": {
5050
"audit": "lerna-audit",
51+
"clean": "lerna run clean",
5152
"build": "lerna run build --scope \"*-query-params\"",
5253
"build:uqp": "lerna run build --scope \"use-query-params\"",
53-
"build:adapter": "lerna run build --scope \"use-query-params-adapter-react-router\"",
54+
"build:adapter": "lerna run build --scope \"use-query-params-adapter-react-router-6\"",
5455
"build:sqp": "lerna run build --scope \"serialize-query-params\"",
5556
"clean:uqp": "lerna run clean --scope \"use-query-params\"",
5657
"test": "vitest",

packages/use-query-params-adapter-react-router/package.json packages/use-query-params-adapter-react-router-6/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "use-query-params-adapter-react-router",
2+
"name": "use-query-params-adapter-react-router-6",
33
"private": true,
44
"version": "0.0.1",
55
"description": "React-router 6 adapter for use-query-params.",

packages/use-query-params-adapter-react-router/src/__tests__/react-router-6.test.tsx packages/use-query-params-adapter-react-router-6/src/__tests__/react-router-6.test.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { unstable_HistoryRouter } from 'react-router-dom';
55
import { describe, afterEach } from 'vitest';
66
import { QueryParamProvider, QueryParamOptions } from 'use-query-params/src';
77
import { testSpec } from 'use-query-params/src/__tests__/routers/shared';
8-
import { ReactRouterAdapter } from '..';
8+
import { ReactRouter6Adapter } from '..';
99

1010
// use this router so we can pass our own history to inspect
1111
const HistoryRouter = unstable_HistoryRouter;
@@ -18,15 +18,15 @@ function renderWithRouter(
1818
const history = createMemoryHistory({ initialEntries: [initialRoute] });
1919
const results = render(
2020
<HistoryRouter history={history}>
21-
<QueryParamProvider adapter={ReactRouterAdapter} options={options}>
21+
<QueryParamProvider adapter={ReactRouter6Adapter} options={options}>
2222
{ui}
2323
</QueryParamProvider>
2424
</HistoryRouter>
2525
);
2626
const rerender = (ui: React.ReactNode, newOptions = options) =>
2727
results.rerender(
2828
<HistoryRouter history={history}>
29-
<QueryParamProvider adapter={ReactRouterAdapter} options={newOptions}>
29+
<QueryParamProvider adapter={ReactRouter6Adapter} options={newOptions}>
3030
{ui}
3131
</QueryParamProvider>
3232
</HistoryRouter>

packages/use-query-params-adapter-react-router/src/index.ts packages/use-query-params-adapter-react-router-6/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
/**
99
* Query Param Adapter for react-router v6
1010
*/
11-
export const ReactRouterAdapter: QueryParamAdapterComponent = ({
11+
export const ReactRouter6Adapter: QueryParamAdapterComponent = ({
1212
children,
1313
}) => {
1414
const navigate = useNavigate();

packages/use-query-params/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"build:adapters": "npx lerna run build --scope \"*-adapter-*\"",
1717
"copy:adapters": "scripts/copy-adapters.js",
1818
"build-website": "npm run test && npm run build && cd examples/website-example && npm run build && npm run copy-build",
19-
"clean": "rimraf dist",
19+
"clean": "rimraf dist adapters",
2020
"dev": "cross-env NODE_ENV=development tsc -m esNext --outDir esm -w",
2121
"prepublishOnly": "npm run test && npm run clean && npm run build",
2222
"lint": "eslint --ext js,ts,tsx src",

0 commit comments

Comments
 (0)