From 2ac4fd93b183e7f1e04c4605f2bc8fae0f4a5ed8 Mon Sep 17 00:00:00 2001 From: Mounir Date: Wed, 7 Aug 2024 10:12:22 -0400 Subject: [PATCH] chore: css optimization --- .../src/app/components/tableRow/TableRow.tsx | 2 +- .../cookieConsent/cookieModal/CookieModal.tsx | 183 +++++++++--------- .../cookieModal/cookie-modal.scss | 17 -- frontend/src/styles/_export.scss | 17 ++ frontend/src/styles/_globals.scss | 10 +- frontend/src/styles/_variables.scss | 5 - 6 files changed, 120 insertions(+), 114 deletions(-) delete mode 100644 frontend/src/app/containers/cookieConsent/cookieModal/cookie-modal.scss diff --git a/frontend/src/app/components/tableRow/TableRow.tsx b/frontend/src/app/components/tableRow/TableRow.tsx index db71974..600372c 100644 --- a/frontend/src/app/components/tableRow/TableRow.tsx +++ b/frontend/src/app/components/tableRow/TableRow.tsx @@ -17,7 +17,7 @@ const StyledMuiTableRow = styled(MuiTableRow)({ }, }); -export default function TableRowRow({ columns, ...props }: ITableRow) { +export default function TableRow({ columns, ...props }: ITableRow) { return ( {columns.map((column, index) => ( diff --git a/frontend/src/app/containers/cookieConsent/cookieModal/CookieModal.tsx b/frontend/src/app/containers/cookieConsent/cookieModal/CookieModal.tsx index 333095d..88a09bc 100644 --- a/frontend/src/app/containers/cookieConsent/cookieModal/CookieModal.tsx +++ b/frontend/src/app/containers/cookieConsent/cookieModal/CookieModal.tsx @@ -19,7 +19,6 @@ import { useState, } from "react"; import { useTranslation } from "react-i18next"; -import "./cookie-modal.scss"; interface ICookieModal { open: boolean; @@ -66,97 +65,103 @@ export default function CookieModal({ return ( -
-
- - {t("cookie_modal__title")} - - - - +
+
+
+ + {t("cookie_modal__title")} + + + + +
+ + {t("cookie_modal__description_1")} + + + {t("cookie_modal__description_2")} + + + + {t("cookie_consent__learn_more")} + +
- - {t("cookie_modal__description_1")} - - - {t("cookie_modal__description_2")} - - - {t("cookie_consent__learn_more")} - - - {t("cookie_modal__description_3")} - +
+ + {t("cookie_modal__description_3")} + -
- {cookieTypes.map((cookieType, index) => ( - - - - {t(cookieType.title)} - - - handleCookieTypeClick(event, cookieType.id) - } - disabled={cookieType.required} - /> - - {cookieType.description.map((description, index) => ( - - {t(description)} - - ))} - {cookieType.cookies && ( -
- - {cookieType.cookies.map((cookie, index) => ( - - ))} -
-
- )} -
- ))} -
+
+ {cookieTypes.map((cookieType, index) => ( + + + + {t(cookieType.title)} + + + handleCookieTypeClick(event, cookieType.id) + } + disabled={cookieType.required} + /> + + {cookieType.description.map((description, index) => ( + + {t(description)} + + ))} + {cookieType.cookies && ( +
+ + {cookieType.cookies.map((cookie, index) => ( + + ))} +
+
+ )} +
+ ))} +
-
- - - +
+ + + +
diff --git a/frontend/src/app/containers/cookieConsent/cookieModal/cookie-modal.scss b/frontend/src/app/containers/cookieConsent/cookieModal/cookie-modal.scss deleted file mode 100644 index 2bbff58..0000000 --- a/frontend/src/app/containers/cookieConsent/cookieModal/cookie-modal.scss +++ /dev/null @@ -1,17 +0,0 @@ -.cookie-modal { - margin: get-spacing(lg); - - &__title { - display: flex; - align-items: center; - justify-content: space-between; - margin-bottom: get-spacing(md); - } - - &__buttons { - display: flex; - justify-content: center; - flex-direction: column; - gap: get-spacing(sm); - } -} diff --git a/frontend/src/styles/_export.scss b/frontend/src/styles/_export.scss index 4b04632..e4545b0 100755 --- a/frontend/src/styles/_export.scss +++ b/frontend/src/styles/_export.scss @@ -2,6 +2,15 @@ = Exports = ============================================ */ +$property: ( + gap: gap, +); + +$property-with-direction: ( + m: margin, + p: padding, +); + @each $colorKey, $colorValue in $color { @each $colorSubkey, $colorSubvalue in $colorValue { #body .color-#{$colorKey}-#{$colorSubkey} { @@ -11,6 +20,14 @@ } @each $propertyKey, $propertyValue in $property { + @each $spacingKey, $spacingValue in $spacing { + #body .#{$propertyKey}-#{$spacingKey} { + #{$propertyValue}: $spacingValue; + } + } +} + +@each $propertyKey, $propertyValue in $property-with-direction { @each $spacingKey, $spacingValue in $spacing { @each $directionKey, $directionValues in $direction { #body .#{$propertyKey}#{$directionKey}-#{$spacingKey} { diff --git a/frontend/src/styles/_globals.scss b/frontend/src/styles/_globals.scss index 940cb25..e36f039 100755 --- a/frontend/src/styles/_globals.scss +++ b/frontend/src/styles/_globals.scss @@ -47,8 +47,14 @@ body { align-items: center; } -.justify-center { - justify-content: center; +.justify { + &-center { + justify-content: center; + } + + &-between { + justify-content: space-between; + } } .text-center { diff --git a/frontend/src/styles/_variables.scss b/frontend/src/styles/_variables.scss index 2f8df71..98b02a8 100755 --- a/frontend/src/styles/_variables.scss +++ b/frontend/src/styles/_variables.scss @@ -132,8 +132,3 @@ $direction: ( x: left right, y: top bottom, ); - -$property: ( - m: margin, - p: padding, -);