From fefe90a1b52c3e6a930041514f52b1be1ceae7ec Mon Sep 17 00:00:00 2001 From: Johan Girod Date: Tue, 12 Sep 2023 17:47:37 +0200 Subject: [PATCH] =?UTF-8?q?Enl=C3=A8ve=20swc=20styled-component=20plugin?= =?UTF-8?q?=20qui=20ajoute=20un=20import=20qui=20ne=20fonctionne=20pas=20e?= =?UTF-8?q?n=20esm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Par conséquent, plus de css=. On remplace par le good'ol style=. --- site/build/prerender-worker.js | 5 +- site/package.json | 8 --- site/source/components/App.tsx | 10 +-- site/source/components/BarChart.tsx | 12 ++-- .../components/CurrentSimulatorCard.tsx | 6 +- site/source/components/Notifications.tsx | 6 +- site/source/components/PageHeader.tsx | 18 ++--- site/source/components/PaySlip.tsx | 25 +++---- .../source/components/PlaceDesEntreprises.tsx | 8 +-- site/source/components/References.tsx | 18 ++--- .../ShareSimulationBanner/index.tsx | 6 +- .../components/Simulation/SimulationGoal.tsx | 14 ++-- .../components/Simulation/SimulationGoals.tsx | 10 +-- site/source/components/Simulation/index.tsx | 18 +++-- site/source/components/charts/PagesCharts.tsx | 10 +-- site/source/components/company/Details.tsx | 8 +-- .../components/company/SearchDetails.tsx | 6 +- .../source/components/company/SearchField.tsx | 8 +-- .../components/conversation/AnswerList.tsx | 44 ++++++------- .../components/conversation/ChoicesInput.tsx | 6 +- .../components/conversation/Conversation.tsx | 24 +++---- .../conversation/select/SelectTauxRisque.tsx | 42 ++++++------ .../Footer/InscriptionBetaTesteur/index.tsx | 10 +-- site/source/components/layout/Header.tsx | 6 +- site/source/components/layout/NewsBanner.tsx | 8 +-- .../SalaryExplanation.tsx | 26 ++++---- .../components/ui/AnimatedTargetValue.tsx | 8 +-- site/source/components/ui/Checklist/index.tsx | 6 +- site/source/components/ui/Progress.tsx | 6 +- site/source/components/ui/Skeleton.tsx | 23 +++---- site/source/components/utils/colors.tsx | 10 +-- site/source/components/utils/markdown.tsx | 45 +++++++------ .../design-system/answer-group/index.tsx | 8 +-- site/source/design-system/card/Card.tsx | 10 +-- site/source/design-system/card/SmallCard.tsx | 6 +- .../source/design-system/layout/Container.tsx | 8 ++- site/source/design-system/popover/Popover.tsx | 12 ++-- site/source/pages/Offline.tsx | 4 +- site/source/pages/_landing/Landing.tsx | 38 +++++------ .../_components/Navigation.tsx | 6 +- .../choix-du-statut/comparateur.tsx | 6 +- .../pages/assistants/choix-du-statut/home.tsx | 14 ++-- .../assistants/choix-du-statut/résultat.tsx | 18 ++--- .../index.tsx | 8 +-- .../components/DéclarationRevenu.tsx | 44 ++++++------- .../components/NotHandledCase.tsx | 16 ++--- .../cotisations.tsx | 16 ++--- .../declaration.tsx | 12 ++-- .../entreprise.tsx | 6 +- .../imposition.tsx | 24 +++---- .../assistants/demande-mobilité/EndBlock.tsx | 16 ++--- .../assistants/demande-mobilité/index.tsx | 20 +++--- .../assistants/pour-mon-entreprise/index.tsx | 24 +++---- .../assistants/recherche-code-ape/Result.tsx | 8 +-- .../ActiviteCard/index.tsx | 16 ++--- .../économie-collaborative/NextButton.tsx | 6 +- site/source/pages/budget/index.tsx | 6 +- site/source/pages/dev/IntegrationTest.tsx | 8 +-- site/source/pages/integration/API.tsx | 6 +- site/source/pages/integration/Iframe.tsx | 66 +++++++++---------- site/source/pages/integration/Library.tsx | 12 ++-- .../auto-entrepreneur/AutoEntrepreneur.tsx | 6 +- .../chômage-partiel/ChômagePartiel.tsx | 26 ++++---- .../components/Comparateur.tsx | 14 ++-- .../components/Détails.tsx | 42 ++++++------ .../components/ModifierOptions.tsx | 22 +++---- .../components/RevenuEstimé.tsx | 20 +++--- .../components/RevenuTable.tsx | 18 ++--- .../components/StatusCard.tsx | 6 +- .../components/StatutChoice.tsx | 18 ++--- .../simulateurs/dividendes/Dividendes.tsx | 8 +-- .../pages/simulateurs/impot-societe/index.tsx | 6 +- .../simulateurs/indépendant/Indépendant.tsx | 6 +- site/source/pages/statistiques/Chart.tsx | 21 +++--- .../source/pages/statistiques/StatsDetail.tsx | 6 +- .../source/pages/statistiques/StatsGlobal.tsx | 64 +++++++++--------- site/vite.config.ts | 13 +--- yarn.lock | 8 --- 78 files changed, 594 insertions(+), 614 deletions(-) diff --git a/site/build/prerender-worker.js b/site/build/prerender-worker.js index 3fd954106..ab799a908 100644 --- a/site/build/prerender-worker.js +++ b/site/build/prerender-worker.js @@ -36,5 +36,8 @@ export default async ({ site, url, lang }) => { await fs.mkdir(dir, { recursive: true }) await fs.writeFile(path.join(dir, 'index.html'), page) - return path.relative(path.join(dirname, '../dist'), path.join(dir, 'index.html')) + return path.relative( + path.join(dirname, '../dist'), + path.join(dir, 'index.html') + ) } diff --git a/site/package.json b/site/package.json index 008687b76..3141459a4 100644 --- a/site/package.json +++ b/site/package.json @@ -22,9 +22,7 @@ "start:axe-debugging": "VITE_AXE_CORE_ENABLED=true vite dev", "start:netlify": "sed 's|:SITE_EN|/infrance|g' netlify.base.toml | sed 's|:SITE_FR|/mon-entreprise|g' | sed 's|:API_URL|http://localhost:3004|g' | sed 's|\\[\\[redirects\\]\\]|\\[\\[redirects\\]\\]\\n force = true|g' > netlify.toml && HMR_CLIENT_PORT=8888 netlify dev", "start:storybook": "storybook dev -p 6006", - "postinstall": "node scripts/prepare.js", - "build": "NODE_OPTIONS='--max-old-space-size=6144'; yarn build:sitemap && yarn build:simulator-data && vite build && yarn build:iframe-script", "build:iframe-script": "NODE_OPTIONS='--max-old-space-size=4096'; vite build --config build/vite-iframe-script.config.ts", "build:prerender": "ts-node-esm build/prerender.ts", @@ -34,20 +32,15 @@ "build:ssr": "NODE_OPTIONS='--max-old-space-size=4096'; vite build --ssr ./source/entries/entry-server.tsx --outDir ./dist/ssr --emptyOutDir && echo '{\"type\": \"module\"}' > dist/package.json", "build:storybook": "NODE_OPTIONS='--max-old-space-size=6144'; storybook build", "build:yaml-to-dts": "ts-node-esm scripts/build-yaml-to-dts.ts", - "preview:mon-entreprise": "sed 's|:SITE_EN|_|g' netlify.preview.toml | sed 's|:SITE_FR||g' | sed 's|:API_URL|http://localhost:3004|g' > dist/netlify.toml && cd dist && netlify dev -d ./ -p 8888", "preview:infrance": " sed 's|:SITE_EN||g' netlify.preview.toml | sed 's|:SITE_FR|_|g' | sed 's|:API_URL|http://localhost:3004|g' > dist/netlify.toml && cd dist && netlify dev -d ./ -p 8889", - "typecheck:watch": "tsc --skipLibCheck --noEmit --watch", - "test": "vitest", "test:dev-e2e:mon-entreprise": "cypress open --e2e --config \"baseUrl=http://localhost:8888\"", "test:dev-e2e:mycompanyinfrance": "cypress open --e2e --config \"baseUrl=http://localhost:8889,specPattern=cypress/integration/mon-entreprise/english/**/*.{js,jsx,ts,tsx}\" --env language=en", "test:record-http-calls:mon-entreprise": "cypress run --env record_http=", - "algolia:clean": "node scripts/search/clean.js", "algolia:update": "yarn build:simulator-data && ts-node-esm ./scripts/search/update-data.ts", - "i18n:check": "yarn i18n:rules:check && yarn i18n:ui:check", "i18n:translate": "yarn i18n:rules:translate && yarn i18n:ui:translate", "i18n:rules:check": "node scripts/i18n/check-missing-rule-translation.js", @@ -121,7 +114,6 @@ "@storybook/react": "^7.0.5", "@storybook/react-vite": "^7.0.5", "@storybook/testing-library": "^0.1.0", - "@swc/plugin-styled-components": "^1.5.76", "@types/history": "^5.0.0", "@types/react": "^18.2.21", "@types/react-dom": "^18.2.7", diff --git a/site/source/components/App.tsx b/site/source/components/App.tsx index 3857a857a..dc8df2d7b 100644 --- a/site/source/components/App.tsx +++ b/site/source/components/App.tsx @@ -117,11 +117,11 @@ const App = () => {
) : ( )} @@ -160,9 +158,9 @@ function InnerBarChartBranch({
{title} diff --git a/site/source/components/CurrentSimulatorCard.tsx b/site/source/components/CurrentSimulatorCard.tsx index e7e7232ca..ac4ed32d3 100644 --- a/site/source/components/CurrentSimulatorCard.tsx +++ b/site/source/components/CurrentSimulatorCard.tsx @@ -29,9 +29,9 @@ export function CurrentSimulatorCard({ item md={12} lg={8} - css={` - margin-bottom: -1rem; - `} + style={{ + marginBottom: '-1rem', + }} > diff --git a/site/source/components/Notifications.tsx b/site/source/components/Notifications.tsx index 216359e99..22f899cb0 100644 --- a/site/source/components/Notifications.tsx +++ b/site/source/components/Notifications.tsx @@ -69,9 +69,9 @@ export default function Notifications() { return (
{messages.map(({ sévérité, dottedName, résumé, description }) => ( diff --git a/site/source/components/PageHeader.tsx b/site/source/components/PageHeader.tsx index 536cb1fe2..75c83a558 100644 --- a/site/source/components/PageHeader.tsx +++ b/site/source/components/PageHeader.tsx @@ -24,20 +24,22 @@ export default function PageHeader({ {titre && ( <> diff --git a/site/source/components/PaySlip.tsx b/site/source/components/PaySlip.tsx index 07feab002..e197d7ba4 100644 --- a/site/source/components/PaySlip.tsx +++ b/site/source/components/PaySlip.tsx @@ -21,6 +21,8 @@ import { ExplicableRule } from './conversation/Explicable' import './PaySlip.css' +import { styled } from 'styled-components' + import { Line, SalaireBrutSection, SalaireNetSection } from './PaySlipSections' export const SECTION_ORDER = [ @@ -108,17 +110,7 @@ export default function PaySlip() { const cotisationsBySection = getCotisationsBySection(parsedRules) return ( -
+
{/* Section salaire net */} -
+
) } @@ -259,3 +251,12 @@ function Cotisation({ dottedName }: { dottedName: DottedName }) { ) } + +const StyledContainer = styled.div` + .value { + display: flex; + align-items: flex-end; + justify-content: flex-end; + padding-right: 0.2em; + } +` diff --git a/site/source/components/PlaceDesEntreprises.tsx b/site/source/components/PlaceDesEntreprises.tsx index e748b29b0..2cdc6bdb4 100644 --- a/site/source/components/PlaceDesEntreprises.tsx +++ b/site/source/components/PlaceDesEntreprises.tsx @@ -78,10 +78,10 @@ export const PlaceDesEntreprisesButton = ({ diff --git a/site/source/components/References.tsx b/site/source/components/References.tsx index e5ba91458..0d616287d 100644 --- a/site/source/components/References.tsx +++ b/site/source/components/References.tsx @@ -59,16 +59,16 @@ function Reference({ href, title }: { href: string; title: string }) { {capitalise0(title)} @@ -76,9 +76,9 @@ function Reference({ href, title }: { href: string; title: string }) { {domain in referencesImages && ( {share && ( diff --git a/site/source/components/Simulation/SimulationGoal.tsx b/site/source/components/Simulation/SimulationGoal.tsx index c20cd4b2a..27df8fb29 100644 --- a/site/source/components/Simulation/SimulationGoal.tsx +++ b/site/source/components/Simulation/SimulationGoal.tsx @@ -77,10 +77,10 @@ export function SimulationGoal({ @@ -88,9 +88,9 @@ export function SimulationGoal({ {isInfoMode ? ( formatLegend(key)} /> ) : ( - + diff --git a/site/source/components/company/SearchDetails.tsx b/site/source/components/company/SearchDetails.tsx index 9c5dab840..78d0e4448 100644 --- a/site/source/components/company/SearchDetails.tsx +++ b/site/source/components/company/SearchDetails.tsx @@ -31,9 +31,9 @@ export default function CompanySearchDetails({

<> {'highlightLabel' in entreprise diff --git a/site/source/components/company/SearchField.tsx b/site/source/components/company/SearchField.tsx index fc759f1b9..76ff5c070 100644 --- a/site/source/components/company/SearchField.tsx +++ b/site/source/components/company/SearchField.tsx @@ -166,10 +166,10 @@ function Results({ aria-label={`${etablissement.label}, Selectionner cette entreprise`} ctaLabel={ } diff --git a/site/source/components/conversation/AnswerList.tsx b/site/source/components/conversation/AnswerList.tsx index c41314c6f..ff0a3de04 100644 --- a/site/source/components/conversation/AnswerList.tsx +++ b/site/source/components/conversation/AnswerList.tsx @@ -105,9 +105,9 @@ export default function AnswerList({ onClose, children }: AnswerListProps) { {children}
@@ -150,26 +150,26 @@ export default function AnswerList({ onClose, children }: AnswerListProps) { Les réponses liées à l'entreprise sont{' '} automatiquement sauvegardées entre les simulations.
- + {t( 'gérer.ressources.annuaire-entreprises.body', 'Retrouvez toutes les informations publiques concernant votre entreprise sur' diff --git a/site/source/components/conversation/ChoicesInput.tsx b/site/source/components/conversation/ChoicesInput.tsx index 7486daf7b..3a7b2e410 100644 --- a/site/source/components/conversation/ChoicesInput.tsx +++ b/site/source/components/conversation/ChoicesInput.tsx @@ -175,9 +175,9 @@ function RadioChoice({ /\s|\./g, '_' )}-${rootDottedName.replace(/\s|\./g, '_')}`} - css={` - margin-top: -1rem; - `} + style={{ + marginTop: '-1rem', + }} >

{node.title} diff --git a/site/source/components/conversation/Conversation.tsx b/site/source/components/conversation/Conversation.tsx index 9dd2b9bde..ad50f5a8d 100644 --- a/site/source/components/conversation/Conversation.tsx +++ b/site/source/components/conversation/Conversation.tsx @@ -114,10 +114,10 @@ export default function Conversation({ ref={formRef} >

{evaluateQuestion(engine, engine.getRule(currentQuestion))} @@ -175,10 +175,10 @@ export default function Conversation({ item xs={12} sm - css={` - justify-content: flex-end; - display: flex; - `} + style={{ + justifyContent: 'flex-end', + display: 'flex', + }} > {customSituationVisualisation} @@ -224,10 +224,10 @@ export default function Conversation({ item xs={6} sm - css={` - justify-content: flex-end; - display: flex; - `} + style={{ + justifyContent: 'flex-end', + display: 'flex', + }} > {customSituationVisualisation} diff --git a/site/source/components/conversation/select/SelectTauxRisque.tsx b/site/source/components/conversation/select/SelectTauxRisque.tsx index 38e0c77ae..2543d2e20 100644 --- a/site/source/components/conversation/select/SelectTauxRisque.tsx +++ b/site/source/components/conversation/select/SelectTauxRisque.tsx @@ -89,38 +89,38 @@ function SelectComponent({ onPress={() => submitOnChange(option)} compact key={JSON.stringify(option)} - css={` - padding: 0.4rem; - margin-top: 0.5rem; - `} + style={{ + padding: '0.4rem', + marginTop: '0.5rem', + }} > {option['Nature du risque']} {formatTauxNet(option['Taux net'])} {option['Catégorie']} diff --git a/site/source/components/layout/Footer/InscriptionBetaTesteur/index.tsx b/site/source/components/layout/Footer/InscriptionBetaTesteur/index.tsx index 7d1151eb7..e6b601378 100644 --- a/site/source/components/layout/Footer/InscriptionBetaTesteur/index.tsx +++ b/site/source/components/layout/Footer/InscriptionBetaTesteur/index.tsx @@ -21,11 +21,11 @@ export default function InscriptionBetaTesteur() { > diff --git a/site/source/components/layout/Header.tsx b/site/source/components/layout/Header.tsx index 10ea5edb6..1524eaa3e 100644 --- a/site/source/components/layout/Header.tsx +++ b/site/source/components/layout/Header.tsx @@ -27,9 +27,9 @@ export default function Header() { return (
{t('Aller au contenu principal')} diff --git a/site/source/components/layout/NewsBanner.tsx b/site/source/components/layout/NewsBanner.tsx index 66c33711c..e1258fa0e 100644 --- a/site/source/components/layout/NewsBanner.tsx +++ b/site/source/components/layout/NewsBanner.tsx @@ -53,10 +53,10 @@ function NewsBanner({ lastRelease }: { lastRelease: LastRelease }) { return (

Fiche de paie @@ -111,15 +111,15 @@ function RevenueRepartitionSection(props: { onSeePayslip: () => void }) { return (

Répartition du total chargé diff --git a/site/source/components/ui/AnimatedTargetValue.tsx b/site/source/components/ui/AnimatedTargetValue.tsx index 28824f882..15bf7d51a 100644 --- a/site/source/components/ui/AnimatedTargetValue.tsx +++ b/site/source/components/ui/AnimatedTargetValue.tsx @@ -56,10 +56,10 @@ export default function AnimatedTargetValue({ className="print-hidden" aria-hidden key={difference} - css={` - position: relative; - text-align: right; - `} + style={{ + position: 'relative', + textAlign: 'right', + }} > {formatDifference(difference ?? 0, language)} diff --git a/site/source/components/ui/Checklist/index.tsx b/site/source/components/ui/Checklist/index.tsx index 8d44fb55f..0c73aea34 100644 --- a/site/source/components/ui/Checklist/index.tsx +++ b/site/source/components/ui/Checklist/index.tsx @@ -75,9 +75,9 @@ export function CheckItem({ sm={10} md={8} lg={6} - css={` - margin-left: 2rem; - `} + style={{ + marginLeft: '2rem', + }} > {typeof explanations === 'string' ? ( {explanations} diff --git a/site/source/components/ui/Progress.tsx b/site/source/components/ui/Progress.tsx index 1c28b39a8..f966518f5 100644 --- a/site/source/components/ui/Progress.tsx +++ b/site/source/components/ui/Progress.tsx @@ -32,9 +32,9 @@ export default function Progress({ return (
‌ diff --git a/site/source/components/utils/colors.tsx b/site/source/components/utils/colors.tsx index c79b322bc..e4c84bba3 100644 --- a/site/source/components/utils/colors.tsx +++ b/site/source/components/utils/colors.tsx @@ -81,11 +81,11 @@ export function ThemeColorsProvider({ children }: ProviderProps) {
{children}
diff --git a/site/source/components/utils/markdown.tsx b/site/source/components/utils/markdown.tsx index 9f7f2134f..aa82691b1 100644 --- a/site/source/components/utils/markdown.tsx +++ b/site/source/components/utils/markdown.tsx @@ -218,33 +218,32 @@ export function HeadingWithAnchorLink({ ) return ( - + {childrenWithAnchor} - + ) } +const StyledHeading = styled(Heading)` + position: relative; + + .anchor-link { + display: none; + position: absolute; + top: 0; + left: 0; + transform: translateX(-100%); + padding-right: 6px; + color: var(--lighterTextColor); + background-color: inherit; + text-decoration: none; + font-size: 0.8em; + } + &:hover .anchor-link { + display: block; + } +` + type HeadingProps = { level: number children: React.ReactNode diff --git a/site/source/design-system/answer-group/index.tsx b/site/source/design-system/answer-group/index.tsx index 365f3695c..2abf7d78f 100644 --- a/site/source/design-system/answer-group/index.tsx +++ b/site/source/design-system/answer-group/index.tsx @@ -11,10 +11,10 @@ const AnswerGroup: FunctionComponent = ({ }) => { return (
{Children.map(children, (c, i) => ( diff --git a/site/source/design-system/card/Card.tsx b/site/source/design-system/card/Card.tsx index 1c72bd219..4171cbc9a 100644 --- a/site/source/design-system/card/Card.tsx +++ b/site/source/design-system/card/Card.tsx @@ -72,11 +72,11 @@ export function Card(props: CardProps) { ))}
{children}
diff --git a/site/source/design-system/card/SmallCard.tsx b/site/source/design-system/card/SmallCard.tsx index 062cbdd85..7ff11bf84 100644 --- a/site/source/design-system/card/SmallCard.tsx +++ b/site/source/design-system/card/SmallCard.tsx @@ -38,9 +38,9 @@ export function SmallCard({ {icon}
diff --git a/site/source/design-system/layout/Container.tsx b/site/source/design-system/layout/Container.tsx index 032454422..8b150f016 100644 --- a/site/source/design-system/layout/Container.tsx +++ b/site/source/design-system/layout/Container.tsx @@ -54,6 +54,7 @@ type ContainerProps = { forceTheme?: ThemeType backgroundColor?: (theme: DefaultTheme) => string className?: string + style?: React.CSSProperties } export default function Container({ @@ -61,6 +62,7 @@ export default function Container({ forceTheme, children, className, + style, }: ContainerProps) { const theme = useTheme() const background = useMemo( @@ -75,7 +77,11 @@ export default function Container({ return ( - + {children} diff --git a/site/source/design-system/popover/Popover.tsx b/site/source/design-system/popover/Popover.tsx index e3c99135d..9ca274977 100644 --- a/site/source/design-system/popover/Popover.tsx +++ b/site/source/design-system/popover/Popover.tsx @@ -75,17 +75,17 @@ export default function Popover( 'transparent'}> {/* If you use an iframe in the children, be careful because you need a diff --git a/site/source/pages/Offline.tsx b/site/source/pages/Offline.tsx index 90d7f7995..6e115e22c 100644 --- a/site/source/pages/Offline.tsx +++ b/site/source/pages/Offline.tsx @@ -11,7 +11,7 @@ export default function Offline() { return ( @@ -22,7 +22,7 @@ export default function Offline() { 'Vous êtes actuellement hors ligne.' )} /> - + Vous êtes actuellement hors ligne. Cette page n'a pas encore été téléchargée et n'est donc pas diff --git a/site/source/pages/_landing/Landing.tsx b/site/source/pages/_landing/Landing.tsx index 4b2dc422a..df0624b41 100644 --- a/site/source/pages/_landing/Landing.tsx +++ b/site/source/pages/_landing/Landing.tsx @@ -71,10 +71,10 @@ export default function Landing() { @@ -85,17 +85,17 @@ export default function Landing() {
0 ? 'block' : 'none'}; - `} + style={{ + border: '2px dashed blue', + display: version > 0 ? 'block' : 'none', + }} >
diff --git a/site/source/pages/integration/API.tsx b/site/source/pages/integration/API.tsx index 751305eb5..7ef709a35 100644 --- a/site/source/pages/integration/API.tsx +++ b/site/source/pages/integration/API.tsx @@ -83,9 +83,9 @@ export default function API() {