From 13523f45a3ef71657ac5996c4bdefa3137c0a5ed Mon Sep 17 00:00:00 2001 From: Maxime Quandalle Date: Wed, 16 Feb 2022 14:03:34 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Corrige=20les=20erreurs=20dans?= =?UTF-8?q?=20la=20console?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/conversation/NumberInput.tsx | 1 - .../components/utils/useSimulationConfig.ts | 9 +- site/source/design-system/buttons/Button.tsx | 20 ++-- .../design-system/buttons/ButtonHelp.tsx | 11 +- site/source/design-system/card/Card.tsx | 10 +- .../design-system/field/SearchField.tsx | 1 - .../design-system/field/Select/index.tsx | 4 +- site/source/locales/ui-en.yaml | 101 +++++++++--------- site/source/locales/ui-fr.yaml | 28 ++--- .../pages/Simulateurs/ChômagePartiel.tsx | 89 +++++++-------- site/source/pages/Simulateurs/metadata.tsx | 32 +++--- 11 files changed, 154 insertions(+), 152 deletions(-) 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 ( ( - +