From d086f802f899cde76194f9da689d87e6ce69565d Mon Sep 17 00:00:00 2001 From: cha0s Date: Fri, 12 Jul 2024 00:00:48 -0500 Subject: [PATCH] feat: DOM scale context --- app/context/dom-scale.js | 9 +++++++++ app/react-components/dom.jsx | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 app/context/dom-scale.js diff --git a/app/context/dom-scale.js b/app/context/dom-scale.js new file mode 100644 index 0000000..982edb3 --- /dev/null +++ b/app/context/dom-scale.js @@ -0,0 +1,9 @@ +import {createContext, useContext} from 'react'; + +const context = createContext(); + +export default context; + +export function useDomScale() { + return useContext(context); +} diff --git a/app/react-components/dom.jsx b/app/react-components/dom.jsx index b041c7a..d5207aa 100644 --- a/app/react-components/dom.jsx +++ b/app/react-components/dom.jsx @@ -1,6 +1,7 @@ import {useEffect, useRef, useState} from 'react'; import {RESOLUTION} from '@/constants.js'; +import DomContext from '@/context/dom-scale.js'; import styles from './dom.module.css'; @@ -35,7 +36,9 @@ export default function Dom({children}) { } `} )} - {children} + + {children} + ); }