diff --git a/src/components/Analysis/Comparison/fluidPerformanceIndicator.scss b/src/components/Analysis/Comparison/fluidPerformanceIndicator.scss index 6213c8fdc63a80db0122e252487db98e19b5f4fb..4457dccc9a5eb45d45950391ac206451b1de7afd 100644 --- a/src/components/Analysis/Comparison/fluidPerformanceIndicator.scss +++ b/src/components/Analysis/Comparison/fluidPerformanceIndicator.scss @@ -14,10 +14,8 @@ //MultiFluidIndicator .fi-content { min-height: 23.875rem; - width: 45.75rem; - @media #{$large-phone} { - width: 100%; - } + max-width: 45.75rem; + width: 100%; .fi-header { margin-top: 1rem; margin-bottom: 1.25rem; diff --git a/src/components/Analysis/monthlyanalysis.scss b/src/components/Analysis/monthlyanalysis.scss index 15f293d72097d6eeab8e3212c9e6f473ae7679d0..2d7afc608946784ee4dd2714cb147b7a35c7fc74 100644 --- a/src/components/Analysis/monthlyanalysis.scss +++ b/src/components/Analysis/monthlyanalysis.scss @@ -1,5 +1,4 @@ @import 'src/styles/base/color'; -@import 'src/styles/base/breakpoint'; .analysis-root { display: flex; @@ -9,11 +8,8 @@ gap: 1rem; .analysis-content { - width: 45.75rem; - - @media #{$large-phone} { - width: 100%; - } + max-width: 45.75rem; + width: 100%; } .status-header { display: grid; diff --git a/src/components/Consumption/ConsumptionDetails/consumptionDetails.scss b/src/components/Consumption/ConsumptionDetails/consumptionDetails.scss index e8827802dc2190d78ceb48102985d6b4840ea29e..8935757ac095da52dcabaf4cf072c73b30525f5b 100644 --- a/src/components/Consumption/ConsumptionDetails/consumptionDetails.scss +++ b/src/components/Consumption/ConsumptionDetails/consumptionDetails.scss @@ -1,5 +1,4 @@ @import 'src/styles/base/color'; -@import 'src/styles/base/breakpoint'; .consumption-details-root { display: flex; @@ -12,10 +11,8 @@ margin-bottom: 1rem; .consumption-details-content { - width: 45.75rem; - @media #{$large-phone} { - width: 100%; - } + max-width: 45.75rem; + width: 100%; .consumption-details-header { margin-bottom: 0.5rem; color: $grey-bright; diff --git a/src/components/Consumption/FluidButtons/fluidButtons.scss b/src/components/Consumption/FluidButtons/fluidButtons.scss index fa69ea60a74c195fe770053c1cc2a84d3e6e3213..7d120d2ee0249a4169662704f3691d5acf693d15 100644 --- a/src/components/Consumption/FluidButtons/fluidButtons.scss +++ b/src/components/Consumption/FluidButtons/fluidButtons.scss @@ -1,5 +1,4 @@ @import 'src/styles/base/color'; -@import 'src/styles/base/breakpoint'; .fluid-buttons { background: $dark-light-2; @@ -10,11 +9,9 @@ align-items: center; justify-content: space-evenly; box-sizing: border-box; - width: 45.75rem; margin: auto; - @media #{$large-phone} { - width: 100%; - } + max-width: 45.75rem; + width: 100%; } .fluid-button { min-width: 80px; diff --git a/src/components/Consumption/consumptionView.scss b/src/components/Consumption/consumptionView.scss index 174d986a8c3b601c82e2a35243727d1f0843b622..ce636ccffbc6ca9efe5bd83c55e3a7eba6f8b436 100644 --- a/src/components/Consumption/consumptionView.scss +++ b/src/components/Consumption/consumptionView.scss @@ -18,11 +18,11 @@ .konnector-section { background-color: $default-background; margin: 0 auto; - width: 45.75rem; box-sizing: border-box; padding-bottom: 1rem; + max-width: 45.75rem; + width: 100%; @media #{$large-phone} { - width: 100%; padding-left: 1rem; padding-right: 1rem; } diff --git a/src/components/Options/ExportData/exportData.scss b/src/components/Options/ExportData/exportData.scss index 3b6852c49d53ced72d8498bba3d73558e04f0d3f..38965f5bda1dfdb3df48e6da1c58ed4bc7f6c841 100644 --- a/src/components/Options/ExportData/exportData.scss +++ b/src/components/Options/ExportData/exportData.scss @@ -1,6 +1,4 @@ @import 'src/styles/base/color'; -@import 'src/styles/base/breakpoint'; -@import 'src/styles/base/mixins'; div.expansion-panel-root, div.expansion-panel-root.Mui-expanded:last-child { @@ -16,10 +14,8 @@ div.expansion-panel-root.Mui-expanded:last-child { padding: 0 1.5rem; .export-option-content { - width: 45.75rem; - @media #{$large-phone} { - width: 100%; - } + max-width: 45.75rem; + width: 100%; .MuiAccordionSummary-content { margin: 0; } diff --git a/src/components/Options/GCU/gcuLink.scss b/src/components/Options/GCU/gcuLink.scss index b63f84bd5ff426139409cbbfdc23a2aac7951e3c..3a88a80d9508fa3a7c92a992ae35bcae66fdb6da 100644 --- a/src/components/Options/GCU/gcuLink.scss +++ b/src/components/Options/GCU/gcuLink.scss @@ -1,4 +1,3 @@ -@import 'src/styles/base/breakpoint'; @import 'src/styles/base/color'; .gcu-link-root { @@ -33,10 +32,8 @@ .ln-contact { color: $multi-color; } - width: 45.75rem; - @media #{$large-phone} { - width: 100%; - } + max-width: 45.75rem; + width: 100%; } } @@ -48,9 +45,6 @@ flex-direction: row; margin: -0.75rem 0; width: 100%; - @media #{$large-phone} { - width: 100%; - } .gcu-link-card-content { display: flex; flex-direction: row; diff --git a/src/components/Options/HelpLink/HelpLink.scss b/src/components/Options/HelpLink/HelpLink.scss index dc6ae18729ad0eff8cc08c02014a03073245811f..453d742a2340d847f201ad000603aa2bc2ec0c34 100644 --- a/src/components/Options/HelpLink/HelpLink.scss +++ b/src/components/Options/HelpLink/HelpLink.scss @@ -1,5 +1,4 @@ @import 'src/styles/base/color'; -@import 'src/styles/base/breakpoint'; .help-root { display: flex; @@ -9,14 +8,13 @@ padding: 0 1.5rem; margin-top: 2rem; .help-content { - width: 45.75rem; + max-width: 45.75rem; + width: 100%; a { color: $white; text-decoration: none; } - @media #{$large-phone} { - width: 100%; - } + .help-header { color: $grey-bright; margin-bottom: 1rem; @@ -33,9 +31,6 @@ flex-direction: row; margin: -0.75rem 0; width: 100%; - @media #{$large-phone} { - width: 100%; - } .help-card-content { display: flex; flex-direction: row; diff --git a/src/components/Options/MatomoOptOut/matomoOptOut.scss b/src/components/Options/MatomoOptOut/matomoOptOut.scss index 830a9fb804007b926142b5da14febf8facf8cca5..0c4754fbe8456e6802f8c6232b27c586ee52ef17 100644 --- a/src/components/Options/MatomoOptOut/matomoOptOut.scss +++ b/src/components/Options/MatomoOptOut/matomoOptOut.scss @@ -1,5 +1,4 @@ @import 'src/styles/base/color'; -@import 'src/styles/base/breakpoint'; @import 'src/styles/base/typo-variables'; .matomo-opt-out-container { @@ -12,10 +11,8 @@ .matomo-opt-out { margin: 0 auto; + max-width: 45.75rem; width: 100%; - @media (min-width: $width-large-phone) { - width: 45.75rem; - } .opt-out-header { color: $grey-bright; } diff --git a/src/components/Options/ProfileTypeOptions/profileTypeOptions.scss b/src/components/Options/ProfileTypeOptions/profileTypeOptions.scss index bf2af832185968d3d81c9d6ceec7b75458b39a90..daf6c7bd9e57767796e21deb07041f380b80db2c 100644 --- a/src/components/Options/ProfileTypeOptions/profileTypeOptions.scss +++ b/src/components/Options/ProfileTypeOptions/profileTypeOptions.scss @@ -6,10 +6,8 @@ padding: 0 1.5rem; .profile-type-content { margin: 0 auto; + max-width: 45.75rem; width: 100%; - @media (min-width: $width-large-phone) { - width: 45.75rem; - } .MuiButtonBase-root { height: 40px; margin: 0; diff --git a/src/components/Options/ReportOptions/ReportOptions.spec.tsx b/src/components/Options/ReportOptions/ReportOptions.spec.tsx index 711a1ce72e0bf177c4aef9ff76a583cb510c2a4f..008e755404fc612cda3a1c5c722377e7d0185da5 100644 --- a/src/components/Options/ReportOptions/ReportOptions.spec.tsx +++ b/src/components/Options/ReportOptions/ReportOptions.spec.tsx @@ -32,7 +32,7 @@ describe('ReportOptions component', () => { <ReportOptions /> </Provider> ) - expect(screen.getByText('profile.report.deactivate')).toBeInTheDocument() + expect(screen.getAllByRole('checkbox')[0]).toBeChecked() }) it('should update the profile with sendAnalysisNotification to false', async () => { @@ -41,7 +41,7 @@ describe('ReportOptions component', () => { <ReportOptions /> </Provider> ) - await userEvent.click(screen.getAllByRole('button')[0]) + await userEvent.click(screen.getAllByRole('checkbox')[0]) expect(updateProfileSpy).toHaveBeenCalledTimes(1) expect(updateProfileSpy).toHaveBeenCalledWith({ sendAnalysisNotification: false, @@ -57,7 +57,7 @@ describe('ReportOptions component', () => { <ReportOptions /> </Provider> ) - await userEvent.click(screen.getAllByRole('button')[0]) + await userEvent.click(screen.getAllByRole('checkbox')[0]) expect(updateProfileSpy).toHaveBeenCalledTimes(1) expect(updateProfileSpy).toHaveBeenCalledWith({ sendAnalysisNotification: true, @@ -75,8 +75,8 @@ describe('ReportOptions component', () => { <ReportOptions /> </Provider> ) - expect(screen.getByRole('checkbox')).not.toBeChecked() - await userEvent.click(screen.getByRole('checkbox')) + expect(screen.getAllByRole('checkbox')[1]).not.toBeChecked() + await userEvent.click(screen.getAllByRole('checkbox')[1]) expect(updateProfileSpy).toHaveBeenCalledTimes(1) expect(updateProfileSpy).toHaveBeenCalledWith({ sendConsumptionAlert: true, diff --git a/src/components/Options/ReportOptions/ReportOptions.tsx b/src/components/Options/ReportOptions/ReportOptions.tsx index 7a2578a8c44f9da552fb06b88a034a8969727ef9..30dc6917cfcdb8abfe8516f5a3bf89101ffebb90 100644 --- a/src/components/Options/ReportOptions/ReportOptions.tsx +++ b/src/components/Options/ReportOptions/ReportOptions.tsx @@ -1,4 +1,3 @@ -import { Button } from '@material-ui/core' import StyledSwitch from 'components/CommonKit/Switch/StyledSwitch' import { useClient } from 'cozy-client' import { useI18n } from 'cozy-ui/transpiled/react/I18n' @@ -95,84 +94,71 @@ const ReportOptions = () => { return ( <div className="report-option-root"> <div className="report-option-content"> - <div className="head text-16-normal-uppercase"> - {t('profile.report.title_bilan')} - </div> {/* Monthly Report activation */} - <div className="switch-container-bilan"> - <span className="switch-label text-16-normal"> + <div className="reportCard"> + <div className="row"> + <StyledSwitch + onClick={toggleAnalysisNotification} + checked={profile.sendAnalysisNotification} + /> + <span className="text-16-normal-uppercase"> + {t('profile.report.title_bilan')} + </span> + </div> + <span className="text-16-normal"> {t('profile.report.switch_label_bilan')} </span> - <div className="button-container"> - <Button - aria-label={t('unsubscribe.button_accessibility')} - onClick={() => toggleAnalysisNotification()} - variant="contained" - classes={{ - root: 'btnPrimary', - label: 'text-18-bold', - }} - > - {profile.sendAnalysisNotification - ? t('profile.report.deactivate') - : t('profile.report.activate')} - </Button> - </div> </div> {/* Consumption Alert activation */} {isWaterConnected && ( - <> - <div className="head text-16-normal-uppercase"> - {t('profile.report.title_alert')} - </div> - <div className="waterAlert"> - <div className="switch-container-alert"> - <StyledSwitch - checked={profile.sendConsumptionAlert} - onChange={handleAlertChange} - inputProps={{ - 'aria-label': t( - 'profile.accessibility.button_toggle_consumption_alert' - ), - }} - /> - <span className="text-16-normal"> - {t('profile.report.switch_label_alert')} - </span> + <div className="reportCard"> + <div className="row"> + <StyledSwitch + checked={profile.sendConsumptionAlert} + onChange={handleAlertChange} + /> + + <div className="text-16-normal-uppercase"> + {t('profile.report.title_alert')} </div> - {profile.sendConsumptionAlert && ( - <> - <div className="text-16-normal"> - {t('profile.report.input_label_alert')} - </div> - <div className="switch-container-alert"> - <input - className="inputNumber text-18" - type="number" - defaultValue={ - profile.waterDailyConsumptionLimit === 0 - ? '' - : profile.waterDailyConsumptionLimit - } - onBlur={setWaterLimit} - aria-label={t( - 'profile.accessibility.input_water_alert_report' - )} - inputMode="numeric" - /> - <span className="switch-label text-16-normal">L</span> - </div> - {maxDayData && ( - <div className="alert-input-subtext text-14"> - {t('profile.report.input_label_subtext_alert')} - {Math.round(maxDayData.value)} - {' L'} - </div> - )} - </> - )} </div> - </> + + <span className="text-16-normal"> + {t('profile.report.switch_label_alert')} + </span> + + {profile.sendConsumptionAlert && ( + <> + <div className="text-16-normal"> + {t('profile.report.input_label_alert')} + </div> + <div className="switch-container-alert"> + <input + className="inputNumber text-18" + type="number" + defaultValue={ + profile.waterDailyConsumptionLimit === 0 + ? '' + : profile.waterDailyConsumptionLimit + } + onBlur={setWaterLimit} + aria-label={t( + 'profile.accessibility.input_water_alert_report' + )} + inputMode="numeric" + /> + <span className="switch-label text-16-normal">L</span> + </div> + {maxDayData && ( + <div className="alert-input-subtext text-14"> + {t('profile.report.input_label_subtext_alert')} + {Math.round(maxDayData.value)} + {' L'} + </div> + )} + </> + )} + </div> )} </div> </div> diff --git a/src/components/Options/ReportOptions/reportOptions.scss b/src/components/Options/ReportOptions/reportOptions.scss index e6da9654a6abbfea2078b034b6eb2c741d893118..58ab12b6b0aaa790e6c71101041272ca86361267 100644 --- a/src/components/Options/ReportOptions/reportOptions.scss +++ b/src/components/Options/ReportOptions/reportOptions.scss @@ -1,5 +1,6 @@ @import 'src/styles/base/color'; @import 'src/styles/base/breakpoint'; + .report-option-root { display: flex; flex-direction: column; @@ -8,48 +9,40 @@ padding: 0 1.5rem; margin-top: 2rem; .report-option-content { - width: 45.75rem; - @media #{$large-phone} { - width: 100%; - } + max-width: 45.75rem; + width: 100%; + display: flex; + flex-direction: column; + gap: 2rem; } .head { color: $grey-bright; margin-bottom: 1rem; } - .switch-container-bilan { - display: flex; - flex-direction: column; - color: $grey-bright; - margin-bottom: 2rem; - .switch-label { - margin-left: 0.2rem; - padding-right: 0.8rem; - } - .button-container { - max-width: 200px; - button { - width: 125px; - margin-top: 0.75rem; - } - } - } - .waterAlert { + .reportCard { + border: 1px solid #383941; + border-radius: 4px; + padding: 12px 16px; display: flex; flex-direction: column; - gap: 1rem; + gap: 10px; color: $grey-bright; - - .switch-container-alert { - color: $grey-bright; + .row { display: flex; + flex-direction: row; align-items: center; - gap: 0.5rem; } + } - .alert-input-subtext { - color: $soft-grey; - } + .switch-container-alert { + color: $grey-bright; + display: flex; + align-items: center; + gap: 0.5rem; + } + + .alert-input-subtext { + color: $soft-grey; } } diff --git a/src/components/Options/__snapshots__/OptionsView.spec.tsx.snap b/src/components/Options/__snapshots__/OptionsView.spec.tsx.snap index f4e64582fee87f31407a828cb43e6fc24141d170..eee51c9ad1383e8c55bd7bbb53ab0d99fe3e5af1 100644 --- a/src/components/Options/__snapshots__/OptionsView.spec.tsx.snap +++ b/src/components/Options/__snapshots__/OptionsView.spec.tsx.snap @@ -159,37 +159,50 @@ exports[`OptionsView component should be rendered correctly 1`] = ` class="report-option-content" > <div - class="head text-16-normal-uppercase" - > - profile.report.title_bilan - </div> - <div - class="switch-container-bilan" + class="reportCard" > - <span - class="switch-label text-16-normal" - > - profile.report.switch_label_bilan - </span> <div - class="button-container" + class="row" > - <button - aria-label="unsubscribe.button_accessibility" - class="MuiButtonBase-root MuiButton-root btnPrimary MuiButton-contained" - tabindex="0" - type="button" + <span + class="MuiSwitch-root WithStyles(ForwardRef(Switch))-root-3" > <span - class="MuiButton-label text-18-bold" + aria-disabled="false" + class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-7 MuiSwitch-switchBase WithStyles(ForwardRef(Switch))-switchBase-4 MuiSwitch-colorSecondary PrivateSwitchBase-checked-8 Mui-checked WithStyles(ForwardRef(Switch))-checked-5" > - profile.report.deactivate + <span + class="MuiIconButton-label" + > + <input + checked="" + class="PrivateSwitchBase-input-10 MuiSwitch-input" + type="checkbox" + value="" + /> + <span + class="MuiSwitch-thumb" + /> + </span> + <span + class="MuiTouchRipple-root" + /> </span> <span - class="MuiTouchRipple-root" + class="MuiSwitch-track WithStyles(ForwardRef(Switch))-track-6" /> - </button> + </span> + <span + class="text-16-normal-uppercase" + > + profile.report.title_bilan + </span> </div> + <span + class="text-16-normal" + > + profile.report.switch_label_bilan + </span> </div> </div> </div> diff --git a/src/locales/fr.json b/src/locales/fr.json index 56927c9737dca41569517e13a96f81834891f65e..76f03a79a7decd59d0d64236ea70a7df2a51a76f 100644 --- a/src/locales/fr.json +++ b/src/locales/fr.json @@ -967,14 +967,12 @@ }, "profile": { "report": { + "title_bilan": "Inscription à la lettre mensuelle", + "switch_label_bilan": "Recevoir mon bilan de consommation et des conseils", "title_alert": "Alerte Consommation Excessive d'Eau", - "title_bilan": "Notification par mail", - "switch_label_bilan": "Je reçois la lettre mensuelle contenant un bilan et des conseils sur ma consommation.", "switch_label_alert": "Être prévenu d’un dépassement anormal de ma consommation d’eau", "input_label_alert": "Si ma consommation d’eau quotidienne dépasse :", - "input_label_subtext_alert": "Votre consommation quotidienne maximum sur les 6 derniers mois\u00a0: ", - "activate": "Activer", - "deactivate": "Désactiver" + "input_label_subtext_alert": "Votre consommation quotidienne maximum sur les 6 derniers mois\u00a0: " }, "accessibility": { "button_toggle_mail_report": "Recevoir mon bilan mensuel par mail",