|
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 | | -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"; |
| 6 | +import { fr } from "../fr"; |
| 7 | +import { useIsDark } from "../useIsDark"; |
| 8 | +import { typography } from "../fr/generatedFromCss/typography"; |
| 9 | +import { spacingTokenByValue } from "../fr/generatedFromCss/spacing"; |
11 | 10 | import { assert } from "tsafe/assert"; |
12 | 11 | import { objectKeys } from "tsafe/objectKeys"; |
13 | 12 | import { id } from "tsafe/id"; |
14 | | -import { useBreakpointsValuesPx, type BreakpointsValues } from "./useBreakpointsValuesPx"; |
15 | | -import { structuredCloneButFunctions } from "./tools/structuredCloneButFunctions"; |
16 | | -import { deepAssign } from "./tools/deepAssign"; |
| 13 | +import { useBreakpointsValuesPx, type BreakpointsValues } from "../useBreakpointsValuesPx"; |
| 14 | +import { structuredCloneButFunctions } from "../tools/structuredCloneButFunctions"; |
| 15 | +import { deepAssign } from "../tools/deepAssign"; |
17 | 16 | 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"; |
| 17 | +import { getAssetUrl } from "../tools/getAssetUrl"; |
| 18 | +import { IsGovProvider } from "./useIsGov"; |
| 19 | +import marianneFaviconSvgUrl from "../dsfr/favicon/favicon.svg"; |
| 20 | +import blankFaviconSvgUrl from "../assets/blank-favicon.svg"; |
21 | 21 |
|
22 | 22 | export function getMuiDsfrThemeOptions(params: { |
23 | 23 | isDark: boolean; |
@@ -146,7 +146,7 @@ export function getMuiDsfrThemeOptions(params: { |
146 | 146 | "shadows": (() => { |
147 | 147 | const [, , , , , , , , ...rest] = mui.createTheme().shadows; |
148 | 148 |
|
149 | | - return id<Shadows>([ |
| 149 | + return id<mui.Shadows>([ |
150 | 150 | "none", |
151 | 151 | /** ButtonBar shadow */ |
152 | 152 | "0px 6px 10px 0px rgba(0,0,0,0.07)", |
@@ -570,24 +570,29 @@ export function createDsfrCustomBrandingProvider(params: { |
570 | 570 | }, |
571 | 571 | [`.${fr.cx("fr-footer__bottom-copy")}`]: { |
572 | 572 | display: "none" |
| 573 | + }, |
| 574 | + [`.${fr.cx("fr-btn")}`]: { |
| 575 | + "--hover-tint": theme.palette.primary.dark, |
| 576 | + "--active-tint": mui.darken(theme.palette.primary.main, 0.24), |
| 577 | + "&:hover, &:active": { |
| 578 | + color: theme.palette.primary.contrastText |
| 579 | + } |
| 580 | + }, |
| 581 | + [`.${fr.cx("fr-input")}, .${fr.cx("fr-select")}`]: { |
| 582 | + "&&&": { |
| 583 | + borderTopLeftRadius: `0px`, |
| 584 | + borderTopRightRadius: `0px` |
| 585 | + } |
573 | 586 | } |
574 | 587 | })} |
575 | 588 | /> |
576 | 589 | )} |
577 | | - <context_isGov.Provider value={isGov}> |
| 590 | + <IsGovProvider isGov={isGov}> |
578 | 591 | <mui.ThemeProvider theme={theme}>{children}</mui.ThemeProvider> |
579 | | - </context_isGov.Provider> |
| 592 | + </IsGovProvider> |
580 | 593 | </> |
581 | 594 | ); |
582 | 595 | } |
583 | 596 |
|
584 | 597 | return { DsfrCustomBrandingProvider }; |
585 | 598 | } |
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