diff --git a/site/source/components/conversation/NumberInput.tsx b/site/source/components/conversation/NumberInput.tsx index e19effa90..cc54a1078 100644 --- a/site/source/components/conversation/NumberInput.tsx +++ b/site/source/components/conversation/NumberInput.tsx @@ -108,7 +108,6 @@ function getSerializedUnit( } const formatUnit = getFormatUnit(unit) - console.log(unit, locale, formatUnit) if (!formatUnit) { return ( diff --git a/site/source/components/utils/useSimulationConfig.ts b/site/source/components/utils/useSimulationConfig.ts index 3fafee9c9..51874f97b 100644 --- a/site/source/components/utils/useSimulationConfig.ts +++ b/site/source/components/utils/useSimulationConfig.ts @@ -1,4 +1,5 @@ import { setSimulationConfig } from 'Actions/actions' +import { useEffect } from 'react' import { useDispatch, useSelector } from 'react-redux' import { useHistory } from 'react-router' import { Company } from 'Reducers/inFranceAppReducer' @@ -24,9 +25,11 @@ export default function useSimulationConfig( : undefined const lastConfig = useSelector(configSelector) - if (config && lastConfig !== config) { - dispatch(setSimulationConfig(config ?? {}, url, initialSituation)) - } + useEffect(() => { + if (config && lastConfig !== config) { + dispatch(setSimulationConfig(config ?? {}, url, initialSituation)) + } + }, [config, dispatch, lastConfig, initialSituation, url]) } export function getCompanySituation(company: Company | null): Situation { diff --git a/site/source/design-system/buttons/Button.tsx b/site/source/design-system/buttons/Button.tsx index 5b02534f0..a7fb4ad60 100644 --- a/site/source/design-system/buttons/Button.tsx +++ b/site/source/design-system/buttons/Button.tsx @@ -32,7 +32,7 @@ export const Button = forwardRef(function Button( {...buttonOrLinkProps} className={className} size={size} - light={light} + $light={light} color={color} /> ) @@ -41,7 +41,7 @@ export const Button = forwardRef(function Button( type StyledButtonProps = { color: Color size: Size - light: boolean + $light: boolean isDisabled?: boolean } @@ -93,8 +93,8 @@ export const StyledButton = styled.button` `} /* Primary, secondary & tertiary light colors */ - ${({ light, color, theme }) => - light && + ${({ $light, color, theme }) => + $light && !theme.darkMode && css` color: ${theme.colors.bases[color][color === 'primary' ? 700 : 700]}; @@ -111,9 +111,9 @@ export const StyledButton = styled.button` `} /* White color and light mode (dark background mode) */ - ${({ light, theme }) => + ${({ $light, theme }) => theme.darkMode && - light && + $light && css` background-color: transparent; border-color: ${theme.colors.extended.grey[100]}; @@ -122,11 +122,11 @@ export const StyledButton = styled.button` } /* HOVER STYLE */ :hover { - ${({ theme, color, isDisabled, light }) => + ${({ theme, color, isDisabled, $light }) => isDisabled || theme.darkMode ? '' : /* Primary, secondary & tertiary light colors */ - light + $light ? css` background-color: ${theme.colors.bases[color][ color === 'primary' ? 200 : color === 'secondary' ? 100 : 100 @@ -143,11 +143,11 @@ export const StyledButton = styled.button` /* Dark mode */ @media not print { :hover { - ${({ light, theme, isDisabled }) => + ${({ $light, theme, isDisabled }) => isDisabled || !theme.darkMode ? '' : /* White color and light mode (dark background mode) */ - light + $light ? css` color: rgba(255, 255, 255, 25%); opacity: 1; diff --git a/site/source/design-system/buttons/ButtonHelp.tsx b/site/source/design-system/buttons/ButtonHelp.tsx index 87a733d39..8d1ae9622 100644 --- a/site/source/design-system/buttons/ButtonHelp.tsx +++ b/site/source/design-system/buttons/ButtonHelp.tsx @@ -20,7 +20,7 @@ export default function ButtonHelp({ return ( ( - +