feat: DOM scale context
This commit is contained in:
parent
375b83f366
commit
d086f802f8
9
app/context/dom-scale.js
Normal file
9
app/context/dom-scale.js
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import {createContext, useContext} from 'react';
|
||||||
|
|
||||||
|
const context = createContext();
|
||||||
|
|
||||||
|
export default context;
|
||||||
|
|
||||||
|
export function useDomScale() {
|
||||||
|
return useContext(context);
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
import {useEffect, useRef, useState} from 'react';
|
import {useEffect, useRef, useState} from 'react';
|
||||||
|
|
||||||
import {RESOLUTION} from '@/constants.js';
|
import {RESOLUTION} from '@/constants.js';
|
||||||
|
import DomContext from '@/context/dom-scale.js';
|
||||||
|
|
||||||
import styles from './dom.module.css';
|
import styles from './dom.module.css';
|
||||||
|
|
||||||
|
@ -35,7 +36,9 @@ export default function Dom({children}) {
|
||||||
}
|
}
|
||||||
`}</style>
|
`}</style>
|
||||||
)}
|
)}
|
||||||
|
<DomContext.Provider value={scale}>
|
||||||
{children}
|
{children}
|
||||||
|
</DomContext.Provider>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user