|
1 | 1 | "use client"; |
2 | 2 |
|
3 | 3 | /* eslint-disable @typescript-eslint/no-non-null-assertion */ |
4 | | -import React, { useMemo, useEffect, createContext, useContext, type ReactNode } from "react"; |
| 4 | +import React, { useMemo, useEffect, type ReactNode } from "react"; |
5 | 5 | import * as mui from "@mui/material/styles"; |
6 | 6 | import type { Shadows } from "@mui/material/styles"; |
7 | | -import { fr } from "./fr"; |
8 | | -import { useIsDark } from "./useIsDark"; |
9 | | -import { typography } from "./fr/generatedFromCss/typography"; |
10 | | -import { spacingTokenByValue } from "./fr/generatedFromCss/spacing"; |
| 7 | +import { fr } from "../fr"; |
| 8 | +import { useIsDark } from "../useIsDark"; |
| 9 | +import { typography } from "../fr/generatedFromCss/typography"; |
| 10 | +import { spacingTokenByValue } from "../fr/generatedFromCss/spacing"; |
11 | 11 | import { assert } from "tsafe/assert"; |
12 | 12 | import { objectKeys } from "tsafe/objectKeys"; |
13 | 13 | import { id } from "tsafe/id"; |
14 | | -import { useBreakpointsValuesPx, type BreakpointsValues } from "./useBreakpointsValuesPx"; |
15 | | -import { structuredCloneButFunctions } from "./tools/structuredCloneButFunctions"; |
16 | | -import { deepAssign } from "./tools/deepAssign"; |
| 14 | +import { useBreakpointsValuesPx, type BreakpointsValues } from "../useBreakpointsValuesPx"; |
| 15 | +import { structuredCloneButFunctions } from "../tools/structuredCloneButFunctions"; |
| 16 | +import { deepAssign } from "../tools/deepAssign"; |
17 | 17 | import { Global, css } from "@emotion/react"; |
18 | | -import { getAssetUrl } from "./tools/getAssetUrl"; |
19 | | -import marianneFaviconSvgUrl from "./dsfr/favicon/favicon.svg"; |
20 | | -import blankFaviconSvgUrl from "./assets/blank-favicon.svg"; |
| 18 | +import { getAssetUrl } from "../tools/getAssetUrl"; |
| 19 | +import { IsGovProvider } from "./useIsGov"; |
| 20 | +import marianneFaviconSvgUrl from "../dsfr/favicon/favicon.svg"; |
| 21 | +import blankFaviconSvgUrl from "../assets/blank-favicon.svg"; |
21 | 22 |
|
22 | 23 | export function getMuiDsfrThemeOptions(params: { |
23 | 24 | isDark: boolean; |
@@ -574,20 +575,12 @@ export function createDsfrCustomBrandingProvider(params: { |
574 | 575 | })} |
575 | 576 | /> |
576 | 577 | )} |
577 | | - <context_isGov.Provider value={isGov}> |
| 578 | + <IsGovProvider isGov={isGov}> |
578 | 579 | <mui.ThemeProvider theme={theme}>{children}</mui.ThemeProvider> |
579 | | - </context_isGov.Provider> |
| 580 | + </IsGovProvider> |
580 | 581 | </> |
581 | 582 | ); |
582 | 583 | } |
583 | 584 |
|
584 | 585 | return { DsfrCustomBrandingProvider }; |
585 | 586 | } |
586 | | - |
587 | | -const context_isGov = createContext<boolean>(true); |
588 | | - |
589 | | -export function useIsGov() { |
590 | | - const isGov = useContext(context_isGov); |
591 | | - |
592 | | - return { isGov }; |
593 | | -} |
0 commit comments