diff --git a/package.json b/package.json index f2e0691a..468b23e1 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "next": "14.2.3", "react": "^18", "react-dom": "^18", + "recoil": "^0.7.7", "uuid": "^9.0.1" }, "devDependencies": { diff --git a/src/app/RecoilWrapper.js b/src/app/RecoilWrapper.js new file mode 100644 index 00000000..89cb9776 --- /dev/null +++ b/src/app/RecoilWrapper.js @@ -0,0 +1,6 @@ +'use client' +import { RecoilRoot } from 'recoil' + +export default function RecoilRootWrapper({ children }) { + return {children} +} diff --git a/src/app/layout.js b/src/app/layout.js index 663a8562..84095436 100644 --- a/src/app/layout.js +++ b/src/app/layout.js @@ -1,6 +1,7 @@ import { Inter } from 'next/font/google' import './globals.css' import Headers from '@/components/Headers' +import RecoilRootWrapper from './RecoilWrapper' const inter = Inter({ subsets: ['latin'] }) @@ -14,7 +15,7 @@ export default function RootLayout({ children }) { - {children} + {children} ) diff --git a/src/app/roof2/page.jsx b/src/app/roof2/page.jsx index 03ab033c..81eaaec4 100644 --- a/src/app/roof2/page.jsx +++ b/src/app/roof2/page.jsx @@ -1,10 +1,18 @@ 'use client' import Hero from '@/components/Hero' -import Roof from '@/components/Roof' import Roof2 from '@/components/Roof2' +import { textState } from '@/store/canvasAtom' +import { useEffect } from 'react' +import { useRecoilState } from 'recoil' + +export default function Roof2Page() { + const [text, setText] = useRecoilState(textState) + + useEffect(() => { + console.log(text) + }, []) -export default function RoofPage() { return ( <> diff --git a/src/store/canvasAtom.js b/src/store/canvasAtom.js new file mode 100644 index 00000000..e65aba28 --- /dev/null +++ b/src/store/canvasAtom.js @@ -0,0 +1,6 @@ +import { atom } from 'recoil' + +export const textState = atom({ + key: 'textState', + default: 'test text', +}) diff --git a/yarn.lock b/yarn.lock index f37579d4..d18ffe7e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -646,6 +646,11 @@ graceful-fs@^4.2.11: resolved "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== +hamt_plus@1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/hamt_plus/-/hamt_plus-1.0.2.tgz#e21c252968c7e33b20f6a1b094cd85787a265601" + integrity sha512-t2JXKaehnMb9paaYA7J0BX8QQAY8lwfQ9Gjf4pg/mk4krt+cmwmU652HOoWonf+7+EQV97ARPMhhVgU1ra2GhA== + has-unicode@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" @@ -1174,6 +1179,13 @@ readdirp@~3.6.0: dependencies: picomatch "^2.2.1" +recoil@^0.7.7: + version "0.7.7" + resolved "https://registry.yarnpkg.com/recoil/-/recoil-0.7.7.tgz#c5f2c843224384c9c09e4a62c060fb4c1454dc8e" + integrity sha512-8Og5KPQW9LwC577Vc7Ug2P0vQshkv1y3zG3tSSkWMqkWSwHmE+by06L8JtnGocjW6gcCvfwB3YtrJG6/tWivNQ== + dependencies: + hamt_plus "1.0.2" + requires-port@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz" @@ -1331,7 +1343,14 @@ string_decoder@^1.1.1: dependencies: safe-buffer "~5.2.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": + version "6.0.1" + resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==