Cleanup - unused files / unused exports / duplicate exports
[ProtonMail-WebClient.git] / packages / components / containers / layouts / DensityInjector.tsx
blob05da93cb824b763a16157d3ca8c835a23b50d368
1 import { useLayoutEffect } from 'react';
3 import { useUserSettings } from '@proton/account/userSettings/hooks';
4 import { DENSITY } from '@proton/shared/lib/constants';
6 const { COMPACT, COMFORTABLE } = DENSITY;
8 const CLASSES = {
9     [COMPACT]: 'is-compact',
10     [COMFORTABLE]: 'is-comfortable',
11 } as const;
13 const DensityInjector = () => {
14     const [{ Density } = { Density: COMFORTABLE }] = useUserSettings();
16     useLayoutEffect(() => {
17         document.body.classList.add(CLASSES[Density]);
18         return () => {
19             document.body.classList.remove(CLASSES[Density]);
20         };
21     }, [Density]);
23     return null;
26 export default DensityInjector;