From 74be029ab8a784de301f250bdff566ddc622e726 Mon Sep 17 00:00:00 2001 From: Kent Caparas <144957476+kcaparas1630@users.noreply.github.com> Date: Wed, 31 Jul 2024 16:32:31 -0700 Subject: [PATCH] fix: [BB-314] FIX/Feature** styling fixes stage 1 (#316) * made isHeaderVisible props optional * removed redundant border * removed comments * max-height adheres 100% * transition sync * border in progress bar * decreased margin-top for progress bar --- .../Commons/Button/FieldButtonGroup.styles.ts | 36 +++-------- frontend/src/Commons/FormStyles.styles.ts | 2 +- .../Commons/Forms/FormHeader/FormHeader.tsx | 1 + .../Forms/FormModule/FormModule.style.ts | 14 ++++- .../Commons/Forms/FormModule/FormModule.tsx | 23 ++++---- .../Forms/InputModules/Crops/CropsInfo.tsx | 2 +- .../FarmInformation/FarmInformation.style.ts | 4 ++ .../InputModules/Fertilizers/Fertilizers.tsx | 40 ++++++------- .../FieldsAndSoil/FieldsListComponent.tsx | 59 ++++++++++--------- .../InputModules/ListComponent.styles.ts | 16 ++++- .../MainPageFooter/MainPageFooter.styles.ts | 3 +- .../Commons/MainPageFooter/MainPageFooter.tsx | 9 ++- .../MainPageHeader/MainPageHeader.styles.ts | 47 +++++++-------- .../Commons/MainPageHeader/MainPageHeader.tsx | 4 +- .../Commons/ProgressBar/ProgressBar.styles.ts | 12 +++- .../src/Commons/ProgressBar/ProgressBar.tsx | 5 +- .../src/Views/MainPage/MainPage.styles.ts | 4 +- frontend/src/Views/MainPage/MainPage.tsx | 33 ++++++++++- 18 files changed, 170 insertions(+), 144 deletions(-) diff --git a/frontend/src/Commons/Button/FieldButtonGroup.styles.ts b/frontend/src/Commons/Button/FieldButtonGroup.styles.ts index 71ebf2c5..2ec85dca 100644 --- a/frontend/src/Commons/Button/FieldButtonGroup.styles.ts +++ b/frontend/src/Commons/Button/FieldButtonGroup.styles.ts @@ -12,22 +12,21 @@ const StyledButtonGroupContainer = styled.div` flex-direction: column; gap: 20px; margin: auto; - width: 320px; + width: 100%; justify-content: flex-end; @media (min-width: ${screenSizes.desktop}) { flex-direction: row; - justify-content: flex-start; align-items: center; width: 100%; - height: ${(props) => (props.formCalc ? '50px' : 'auto')}; } `; const StyledButtonContainer = styled.div` - margin-top: 20px; width: ${(props) => (props.formCalc ? '100%' : '')}; + max-width: 327px; @media (min-width: ${screenSizes.desktop}) { display: flex; width: 100%; + max-width: ${(props) => (props.formCalc ? '100%' : '67px')}; justify-content: center; } `; @@ -37,53 +36,32 @@ const StyledNewFieldButtonController = styled.div` justify-content: center; @media (min-width: ${screenSizes.desktop}) { width: 178px; - position: relative; - left: 0; } `; const StyledAddCancelButtonContainer = styled.div` display: flex; flex-direction: column-reverse; + gap: 24px; @media (min-width: ${screenSizes.desktop}) { flex-direction: row; - gap: 20px; - position: absolute; - right: ${(props) => (props.formCrops ? '0' : '17%')}; + margin-top: 10px; } `; -const StyledNewFieldButtonContainer = styled.div` +const StyledNewFieldButtonContainer = styled.div` position: relative; top: 15px; width: 100%; - + margin-bottom: ${(props) => (props.formCrops ? '40cpx' : '0')}; @media (min-width: ${screenSizes.desktop}) { left: 0; } `; -const PrimaryButton = styled.div` - order: 0; - - @media (min-width: ${screenSizes.desktop}) { - order: 1; - } -`; - -const SecondaryButton = styled.div` - order: 1; - - @media (min-width: ${screenSizes.desktop}) { - order: 0; - } -`; - export { StyledButtonGroupContainer, StyledButtonContainer, StyledAddCancelButtonContainer, StyledNewFieldButtonContainer, StyledNewFieldButtonController, - PrimaryButton, - SecondaryButton, }; diff --git a/frontend/src/Commons/FormStyles.styles.ts b/frontend/src/Commons/FormStyles.styles.ts index ed2c3589..0f95fa6d 100644 --- a/frontend/src/Commons/FormStyles.styles.ts +++ b/frontend/src/Commons/FormStyles.styles.ts @@ -68,7 +68,7 @@ const StyledAreaContainer = styled.div` const StyledButtonGroupContainer = styled.div` position: relative; display: flex; - flex-direction: column; + flex-direction: column-reverse; gap: 20px; margin: auto; width: 320px; diff --git a/frontend/src/Commons/Forms/FormHeader/FormHeader.tsx b/frontend/src/Commons/Forms/FormHeader/FormHeader.tsx index 89161b50..bce0cc5f 100644 --- a/frontend/src/Commons/Forms/FormHeader/FormHeader.tsx +++ b/frontend/src/Commons/Forms/FormHeader/FormHeader.tsx @@ -15,6 +15,7 @@ * * @author @GDamaso */ + import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faChevronUp, faChevronDown } from '@fortawesome/free-solid-svg-icons'; import InputModuleInterface from 'src/Interface/InputModuleinterface'; diff --git a/frontend/src/Commons/Forms/FormModule/FormModule.style.ts b/frontend/src/Commons/Forms/FormModule/FormModule.style.ts index 2c199fb3..c3962153 100644 --- a/frontend/src/Commons/Forms/FormModule/FormModule.style.ts +++ b/frontend/src/Commons/Forms/FormModule/FormModule.style.ts @@ -13,21 +13,29 @@ const StyledFormContainer = styled.div` align-items: center; height: 100%; width: 95%; + transition: max-height 3s ease-in-out; @media (min-width: ${screenSizes.desktop}) { max-width: 70%; } `; -const StyledFormContent = styled.div` +const StyledFormContent = styled.div<{ isVisible: boolean }>` width: 100%; color: ${tokens.typographyColorPrimary}; border-radius: 2px; border-top-left-radius: 1px; border-top-right-radius: 1px; - border: 1px solid ${tokens.themeGray40}; - padding: 0 10px 20px 10px; + padding: 0 10px 10px 10px; background-color: ${tokens.themeGray10}; + max-height: ${(props) => (props.isVisible ? '100%' : '0')}; + opacity: ${(props) => (props.isVisible ? 1 : 0)}; + border: ${(props) => (props.isVisible ? `1px solid ${tokens.themeGray40}` : 'none')}; + overflow: hidden; + transition: + max-height 0.3s ease-in-out, + opacity 0.2s ease-in-out, + padding 0.2s ease-in-out; `; export { StyledFormContainer, StyledFormContent }; diff --git a/frontend/src/Commons/Forms/FormModule/FormModule.tsx b/frontend/src/Commons/Forms/FormModule/FormModule.tsx index cdfd2168..ea4eb2c7 100644 --- a/frontend/src/Commons/Forms/FormModule/FormModule.tsx +++ b/frontend/src/Commons/Forms/FormModule/FormModule.tsx @@ -49,25 +49,22 @@ const FormModule: FC = ({ updateFertDetails, }) => { const { InputModuleComponent } = InputModule; - return ( - {InputModule.enable && ( - - - - )} + + + ); }; diff --git a/frontend/src/Commons/Forms/InputModules/Crops/CropsInfo.tsx b/frontend/src/Commons/Forms/InputModules/Crops/CropsInfo.tsx index e3252551..0ae5042f 100644 --- a/frontend/src/Commons/Forms/InputModules/Crops/CropsInfo.tsx +++ b/frontend/src/Commons/Forms/InputModules/Crops/CropsInfo.tsx @@ -320,7 +320,7 @@ const CropsInfoComponent: FC = ({ {!hasFieldBeenSelected[index] && field.Crops.length < 2 && ( - +