diff --git a/site/source/design-system/message/index.tsx b/site/source/design-system/message/index.tsx index deaebb408..700ab3306 100644 --- a/site/source/design-system/message/index.tsx +++ b/site/source/design-system/message/index.tsx @@ -1,6 +1,6 @@ import React from 'react' import { useTranslation } from 'react-i18next' -import styled, { DefaultTheme, css } from 'styled-components' +import styled, { CSSProperties, DefaultTheme, css } from 'styled-components' import { ForceThemeProvider } from '@/components/utils/DarkModeContext' import { Palette, SmallPalette } from '@/types/styled' @@ -19,6 +19,7 @@ type MessageProps = { mini?: boolean light?: boolean className?: string + style?: CSSProperties role?: string } @@ -30,6 +31,7 @@ export function Message({ light = false, children, className, + style, role = undefined, }: MessageProps) { const { t } = useTranslation() @@ -49,6 +51,7 @@ export function Message({ (null) + + useEffect(() => { + const alternatives: Alt[] = [{ match: 'vente', proposal: ['commerce'] }] + + setAlternative(null) + alternatives.forEach((alt) => { + if (new RegExp(alt.match, 'i').test(job)) { + setAlternative(alt) + } + }) + }, [job]) + const ret = ( @@ -185,7 +200,21 @@ export default function SearchCodeAPE({ disabled }: SearchCodeApeProps) { label={t("Mots-clés définissants l'activité")} placeholder={t('Par exemple : coiffure, boulangerie ou restauration')} /> - + {alternative ? ( + + + + + Vous pouvez essayer " + {{ proposal: alternative.proposal.join('", "') }}" au lieu de + "{{ match: alternative.match }}" + + + + + ) : ( + + )} {list.length > 0 && (