From 24796e3c923f094fc1fbb7536f27914d5d0ac957 Mon Sep 17 00:00:00 2001 From: "akfm.sato" Date: Mon, 1 Aug 2022 10:03:32 +0900 Subject: [PATCH] examples: fix format, rename json to transit --- examples/history-sync-transit/README.md | 4 +-- examples/history-sync-transit/package.json | 2 +- examples/history-sync-transit/pages/_app.tsx | 2 +- .../components/ViewStateForm/index.module.css | 2 +- .../src/components/ViewStateForm/index.tsx | 31 ++++++++++--------- examples/url-sync-transit/README.md | 4 +-- examples/url-sync-transit/package.json | 2 +- examples/url-sync-transit/pages/_app.tsx | 2 +- .../components/ViewStateForm/index.module.css | 2 +- .../src/components/ViewStateForm/index.tsx | 31 ++++++++++--------- 10 files changed, 42 insertions(+), 40 deletions(-) diff --git a/examples/history-sync-transit/README.md b/examples/history-sync-transit/README.md index 92736a16..01820338 100755 --- a/examples/history-sync-transit/README.md +++ b/examples/history-sync-transit/README.md @@ -1,6 +1,6 @@ -## history-sync-json +## history-sync-transit -Example of `RecoilHistorySyncJSONNext`. +Example of `RecoilHistorySyncTransitNext`. ```bash # run example application diff --git a/examples/history-sync-transit/package.json b/examples/history-sync-transit/package.json index c251f0d3..671734a6 100644 --- a/examples/history-sync-transit/package.json +++ b/examples/history-sync-transit/package.json @@ -1,5 +1,5 @@ { - "name": "history-sync-json", + "name": "history-sync-transit", "version": "0.1.0", "private": true, "scripts": { diff --git a/examples/history-sync-transit/pages/_app.tsx b/examples/history-sync-transit/pages/_app.tsx index 8d55ce24..dcd43dec 100755 --- a/examples/history-sync-transit/pages/_app.tsx +++ b/examples/history-sync-transit/pages/_app.tsx @@ -14,7 +14,7 @@ function MyApp({ Component, pageProps }: AppProps) { { tag: 'VS', class: ViewState, - write: x => [x.active, x.pos], + write: (x) => [x.active, x.pos], read: ([active, pos]) => new ViewState(active, pos), }, ]} diff --git a/examples/history-sync-transit/src/components/ViewStateForm/index.module.css b/examples/history-sync-transit/src/components/ViewStateForm/index.module.css index f5ffa1f3..ffd40ebc 100644 --- a/examples/history-sync-transit/src/components/ViewStateForm/index.module.css +++ b/examples/history-sync-transit/src/components/ViewStateForm/index.module.css @@ -3,4 +3,4 @@ justify-content: space-between; width: 200px; margin: 0; -} \ No newline at end of file +} diff --git a/examples/history-sync-transit/src/components/ViewStateForm/index.tsx b/examples/history-sync-transit/src/components/ViewStateForm/index.tsx index 92e0d4e2..41abbf2c 100644 --- a/examples/history-sync-transit/src/components/ViewStateForm/index.tsx +++ b/examples/history-sync-transit/src/components/ViewStateForm/index.tsx @@ -5,33 +5,34 @@ import { syncEffect } from 'recoil-sync' import styles from './index.module.css' export class ViewState { - constructor( - public active: boolean, - public pos: [number, number], - ) {} + constructor(public active: boolean, public pos: [number, number]) {} } -const viewStateChecker = custom(x => x instanceof ViewState ? x : null); +const viewStateChecker = custom((x) => (x instanceof ViewState ? x : null)) const viewState = atom({ key: 'viewState', default: new ViewState(true, [1, 2]), - effects: [syncEffect({ storeKey: 'history-transit-store', refine: viewStateChecker })], + effects: [ + syncEffect({ storeKey: 'history-transit-store', refine: viewStateChecker }), + ], }) export const ViewStateForm: React.FC = () => { const [state, setState] = useRecoilState(viewState) const toggleActive = () => setState(new ViewState(!state.active, state.pos)) - const incrementPos = () => setState(new ViewState(state.active, [state.pos[0] + 1, state.pos[1] + 1])) + const incrementPos = () => + setState(new ViewState(state.active, [state.pos[0] + 1, state.pos[1] + 1])) return (
- active: -
-
-
pos: { JSON.stringify(state.pos) }
- -
+ active:{' '} + +
+
+
pos: {JSON.stringify(state.pos)}
+ +
-) -} \ No newline at end of file + ) +} diff --git a/examples/url-sync-transit/README.md b/examples/url-sync-transit/README.md index f2cd61ba..73e522ff 100755 --- a/examples/url-sync-transit/README.md +++ b/examples/url-sync-transit/README.md @@ -1,6 +1,6 @@ -## url-sync-json +## url-sync-transit -Example of `RecoilURLSyncJSONNext`. +Example of `RecoilURLSyncTransitNext`. ```bash # run example application diff --git a/examples/url-sync-transit/package.json b/examples/url-sync-transit/package.json index 7b3b0faf..57558aed 100644 --- a/examples/url-sync-transit/package.json +++ b/examples/url-sync-transit/package.json @@ -1,5 +1,5 @@ { - "name": "url-sync-json", + "name": "url-sync-transit", "version": "0.1.0", "private": true, "scripts": { diff --git a/examples/url-sync-transit/pages/_app.tsx b/examples/url-sync-transit/pages/_app.tsx index ebf603b2..96077836 100755 --- a/examples/url-sync-transit/pages/_app.tsx +++ b/examples/url-sync-transit/pages/_app.tsx @@ -15,7 +15,7 @@ function MyApp({ Component, pageProps }: AppProps) { { tag: 'VS', class: ViewState, - write: x => [x.active, x.pos], + write: (x) => [x.active, x.pos], read: ([active, pos]) => new ViewState(active, pos), }, ]} diff --git a/examples/url-sync-transit/src/components/ViewStateForm/index.module.css b/examples/url-sync-transit/src/components/ViewStateForm/index.module.css index f5ffa1f3..ffd40ebc 100644 --- a/examples/url-sync-transit/src/components/ViewStateForm/index.module.css +++ b/examples/url-sync-transit/src/components/ViewStateForm/index.module.css @@ -3,4 +3,4 @@ justify-content: space-between; width: 200px; margin: 0; -} \ No newline at end of file +} diff --git a/examples/url-sync-transit/src/components/ViewStateForm/index.tsx b/examples/url-sync-transit/src/components/ViewStateForm/index.tsx index 00013046..b8f1d3fb 100644 --- a/examples/url-sync-transit/src/components/ViewStateForm/index.tsx +++ b/examples/url-sync-transit/src/components/ViewStateForm/index.tsx @@ -5,33 +5,34 @@ import { syncEffect } from 'recoil-sync' import styles from './index.module.css' export class ViewState { - constructor( - public active: boolean, - public pos: [number, number], - ) {} + constructor(public active: boolean, public pos: [number, number]) {} } -const viewStateChecker = custom(x => x instanceof ViewState ? x : null); +const viewStateChecker = custom((x) => (x instanceof ViewState ? x : null)) const viewState = atom({ key: 'viewState', default: new ViewState(true, [1, 2]), - effects: [syncEffect({ storeKey: 'url-transit-store', refine: viewStateChecker })], + effects: [ + syncEffect({ storeKey: 'url-transit-store', refine: viewStateChecker }), + ], }) export const ViewStateForm: React.FC = () => { const [state, setState] = useRecoilState(viewState) const toggleActive = () => setState(new ViewState(!state.active, state.pos)) - const incrementPos = () => setState(new ViewState(state.active, [state.pos[0] + 1, state.pos[1] + 1])) + const incrementPos = () => + setState(new ViewState(state.active, [state.pos[0] + 1, state.pos[1] + 1])) return (
- active: -
-
-
pos: { JSON.stringify(state.pos) }
- -
+ active:{' '} + +
+
+
pos: {JSON.stringify(state.pos)}
+ +
-) -} \ No newline at end of file + ) +}