From 1161ad73c5d0c45c205d1e53b4cb946ddb3859c0 Mon Sep 17 00:00:00 2001 From: Jared White Date: Thu, 2 Nov 2023 17:58:48 -0700 Subject: [PATCH] feat: replace UIC `GridSection` with Seeds `Grid` (#3643) * feat: uptake Grid component from Seeds * feat: finish Grid component uptake * feat: update recent changes from main * fix: mangled syntax * fix: switch prop to class name * chore: address linting issues * fix: typo * fix: make sure old UIC labels look more modern * test: use new seeds classes in test selector * test: resolve issue with grid and Cypress selector * test: fix bad ids * fix: grid and form layouts based on feedback * fix: remove old GridCell, tighten up spacing on Partners aside * fix: column layout issues from feedback * chore: grid spacing updates (anticipating Seeds fixes) * chore: update to latest Seeds --- .../cypress/e2e/default/03-listing.spec.ts | 4 +- sites/partners/package.json | 4 +- sites/partners/postcss.config.js | 9 +- .../src/components/applications/Aside.tsx | 26 +- .../DetailsAddressColumns.tsx | 60 +- .../DetailsMemberDrawer.tsx | 161 +++-- .../sections/DetailsAlternateContact.tsx | 92 +-- .../sections/DetailsApplicationData.tsx | 37 +- .../sections/DetailsHouseholdDetails.tsx | 26 +- .../sections/DetailsHouseholdIncome.tsx | 21 +- .../sections/DetailsHouseholdMembers.tsx | 16 +- .../sections/DetailsMultiselectQuestions.tsx | 45 +- .../sections/DetailsPrimaryApplicant.tsx | 201 +++--- .../sections/DetailsTerms.tsx | 18 +- .../PaperApplicationForm/FormMember.tsx | 221 +++--- .../sections/FormAlternateContact.tsx | 94 +-- .../sections/FormApplicationData.tsx | 35 +- .../sections/FormDemographics.tsx | 79 ++- .../sections/FormHouseholdDetails.tsx | 165 ++--- .../sections/FormHouseholdIncome.tsx | 43 +- .../sections/FormHouseholdMembers.tsx | 37 +- .../sections/FormMultiselectQuestions.tsx | 37 +- .../sections/FormPrimaryApplicant.tsx | 138 ++-- .../sections/FormPrograms.tsx | 26 +- .../sections/FormTerms.tsx | 68 +- .../listings/ListingFormActions.tsx | 62 +- .../PaperListingDetails/DetailsUnitDrawer.tsx | 95 +-- .../sections/DetailAdditionalDetails.tsx | 50 +- .../sections/DetailAdditionalEligibility.tsx | 152 ++-- .../sections/DetailAdditionalFees.tsx | 76 +- .../sections/DetailApplicationAddress.tsx | 252 ++++--- .../sections/DetailApplicationDates.tsx | 116 ++-- .../sections/DetailApplicationTypes.tsx | 102 ++- .../sections/DetailBuildingDetails.tsx | 71 +- .../sections/DetailBuildingFeatures.tsx | 104 ++- .../sections/DetailCommunityType.tsx | 52 +- .../sections/DetailLeasingAgent.tsx | 69 +- .../sections/DetailListingData.tsx | 18 +- .../sections/DetailListingIntro.tsx | 36 +- .../sections/DetailListingPhoto.tsx | 75 -- .../sections/DetailListingPhotos.tsx | 37 +- .../sections/DetailNotes.tsx | 28 +- .../sections/DetailPreferences.tsx | 35 +- .../sections/DetailPrograms.tsx | 30 +- .../sections/DetailRankingsAndResults.tsx | 50 +- .../sections/DetailUnits.tsx | 44 +- .../PaperListingDetails/sections/helpers.tsx | 71 +- .../PaperListingForm/OpenHouseForm.tsx | 188 +++-- .../listings/PaperListingForm/UnitForm.tsx | 509 +++++++------- .../sections/AdditionalDetails.tsx | 83 +-- .../sections/AdditionalEligibility.tsx | 121 ++-- .../sections/AdditionalFees.tsx | 120 ++-- .../sections/ApplicationAddress.tsx | 316 +++++---- .../sections/ApplicationDates.tsx | 130 ++-- .../sections/ApplicationTypes.tsx | 145 ++-- .../sections/BuildingDetails.tsx | 312 ++++----- .../sections/BuildingFeatures.tsx | 150 ++-- .../sections/BuildingSelectionCriteria.tsx | 174 ++--- .../sections/CommunityType.tsx | 79 +-- .../sections/LeasingAgent.tsx | 225 +++--- .../sections/ListingIntro.tsx | 158 +++-- .../sections/ListingPhotos.tsx | 27 +- .../sections/LotteryResults.tsx | 29 +- .../sections/RankingsAndResults.tsx | 87 ++- .../sections/SelectAndOrder.tsx | 100 +-- .../PaperListingForm/sections/Units.tsx | 141 ++-- .../components/settings/PreferenceDrawer.tsx | 657 +++++++++--------- .../src/components/shared/SectionWithGrid.tsx | 50 ++ .../src/components/shared/StatusAside.tsx | 8 +- .../src/components/users/FormUserManage.tsx | 194 +++--- .../users/JurisdictionAndListingSelection.tsx | 167 +++-- .../src/pages/application/[id]/review.tsx | 5 +- sites/partners/styles/overrides.scss | 76 +- sites/public/package.json | 2 +- yarn.lock | 64 +- 75 files changed, 3705 insertions(+), 3900 deletions(-) delete mode 100644 sites/partners/src/components/listings/PaperListingDetails/sections/DetailListingPhoto.tsx create mode 100644 sites/partners/src/components/shared/SectionWithGrid.tsx diff --git a/sites/partners/cypress/e2e/default/03-listing.spec.ts b/sites/partners/cypress/e2e/default/03-listing.spec.ts index cd2625fc1a..22936abaeb 100644 --- a/sites/partners/cypress/e2e/default/03-listing.spec.ts +++ b/sites/partners/cypress/e2e/default/03-listing.spec.ts @@ -89,7 +89,9 @@ describe("Listing Management Tests", () => { cy.get(".mt-6 > .is-primary").contains("Save & Exit").click() cy.get("#add-preferences-button").contains("Add Preference").click() cy.get(".border > .button").contains("Select Preferences").click() - cy.get(":nth-child(1) > .grid-section__inner > .field > div > .label") + cy.get( + ":nth-child(1) > .seeds-grid > .seeds-grid-row > .seeds-grid-cell > .field > div > .label" + ) .contains("Live/Work in County") .click() cy.get("#addPreferenceSaveButton").contains("Save").click() diff --git a/sites/partners/package.json b/sites/partners/package.json index 1789baa473..7e7d6bc152 100644 --- a/sites/partners/package.json +++ b/sites/partners/package.json @@ -29,7 +29,7 @@ "@bloom-housing/backend-core": "^7.13.0", "@bloom-housing/shared-helpers": "^7.7.1", "@bloom-housing/ui-components": "12.0.21", - "@bloom-housing/ui-seeds": "^1.9.1", + "@bloom-housing/ui-seeds": "^1.12.0", "@mapbox/mapbox-sdk": "^0.13.0", "ag-grid-community": "^26.0.0", "ag-grid-react": "^26.0.0", @@ -54,6 +54,7 @@ "@axe-core/react": "4.4.3", "@babel/core": "^7.21.3", "@babel/preset-env": "^7.20.2", + "@csstools/postcss-global-data": "^2.0.1", "@cypress/code-coverage": "^3.10.1", "@cypress/webpack-preprocessor": "^5.11.1", "@netlify/plugin-nextjs": "4.30.4", @@ -76,6 +77,7 @@ "next-transpile-modules": "^10.0.0", "nyc": "^15.1.0", "postcss": "^8.3.6", + "postcss-custom-media": "^10.0.0", "sass": "1.52.1", "sass-loader": "^10.0.3", "typescript": "4.6.4", diff --git a/sites/partners/postcss.config.js b/sites/partners/postcss.config.js index e04485a990..0cd5a5d3fe 100644 --- a/sites/partners/postcss.config.js +++ b/sites/partners/postcss.config.js @@ -1,5 +1,12 @@ /*eslint-env node*/ module.exports = { - plugins: ["tailwindcss", "autoprefixer"], + plugins: { + "@csstools/postcss-global-data": { + files: ["../../node_modules/@bloom-housing/ui-seeds/src/global/tokens/screens.scss"], + }, + "postcss-custom-media": {}, + tailwindcss: {}, + autoprefixer: {}, + }, } diff --git a/sites/partners/src/components/applications/Aside.tsx b/sites/partners/src/components/applications/Aside.tsx index 1766931a11..eed1a985c9 100644 --- a/sites/partners/src/components/applications/Aside.tsx +++ b/sites/partners/src/components/applications/Aside.tsx @@ -3,7 +3,6 @@ import dayjs from "dayjs" import { t, Button, - GridCell, AppearanceStyleType, StatusMessages, LocalizedLink, @@ -11,6 +10,7 @@ import { LinkButton, AppearanceSizeType, } from "@bloom-housing/ui-components" +import { Grid } from "@bloom-housing/ui-seeds" import { ApplicationContext } from "./ApplicationContext" import { StatusAside } from "../shared/StatusAside" @@ -41,7 +41,7 @@ const Aside = ({ listingId, type, onDelete, triggerSubmitAndRedirect }: AsidePro const elements = [] const cancel = ( - + {t("t.cancel")} - + ) if (type === "details") { elements.push( - + - , - + , + - + ) } if (type === "add" || type === "edit") { elements.push( - + - + ) if (type === "add") { elements.push( - + - , + , cancel ) } @@ -109,7 +109,7 @@ const Aside = ({ listingId, type, onDelete, triggerSubmitAndRedirect }: AsidePro elements.push(
{cancel} - + - +
) } diff --git a/sites/partners/src/components/applications/PaperApplicationDetails/DetailsAddressColumns.tsx b/sites/partners/src/components/applications/PaperApplicationDetails/DetailsAddressColumns.tsx index d25a07f037..2d9e3ce306 100644 --- a/sites/partners/src/components/applications/PaperApplicationDetails/DetailsAddressColumns.tsx +++ b/sites/partners/src/components/applications/PaperApplicationDetails/DetailsAddressColumns.tsx @@ -1,4 +1,4 @@ -import { t, GridCell } from "@bloom-housing/ui-components" +import { t } from "@bloom-housing/ui-components" import { Application, HouseholdMemberUpdate, @@ -90,38 +90,32 @@ const DetailsAddressColumns = ({ return ( <> - - - {address.street} - - - - - - {address.street2} - - - - - - {address.city} - - - - - - {address.state} - - - - - - {address.zipCode} - - + + {address.street} + + + + {address.street2} + + + + {address.city} + + + + {address.state} + + + + {address.zipCode} + ) } diff --git a/sites/partners/src/components/applications/PaperApplicationDetails/DetailsMemberDrawer.tsx b/sites/partners/src/components/applications/PaperApplicationDetails/DetailsMemberDrawer.tsx index 69f8ef5dba..0267feb24c 100644 --- a/sites/partners/src/components/applications/PaperApplicationDetails/DetailsMemberDrawer.tsx +++ b/sites/partners/src/components/applications/PaperApplicationDetails/DetailsMemberDrawer.tsx @@ -1,9 +1,10 @@ import React from "react" -import { AppearanceStyleType, t, GridSection, Button, Drawer } from "@bloom-housing/ui-components" -import { FieldValue } from "@bloom-housing/ui-seeds" +import { AppearanceStyleType, t, Button, Drawer } from "@bloom-housing/ui-components" +import { Card, FieldValue, Grid } from "@bloom-housing/ui-seeds" import { AddressColsType, DetailsAddressColumns } from "./DetailsAddressColumns" import { Application, HouseholdMemberUpdate } from "@bloom-housing/backend-core/types" import { YesNoAnswer } from "../../../lib/helpers" +import SectionWithGrid from "../../shared/SectionWithGrid" export type MembersDrawer = HouseholdMemberUpdate | null @@ -25,92 +26,98 @@ const DetailsMemberDrawer = ({ ariaDescription={t("application.household.householdMember")} onClose={() => setMembersDrawer(null)} > -
- - - + + + + + - + - + - + - + - + + + + - - - {!(membersDrawer?.sameAddress === YesNoAnswer.Yes) && ( - - - + <> + + {t("application.details.residenceAddress")} + + + + + )} {membersDrawer?.workInRegion === YesNoAnswer.Yes && ( - - - + <> + + {t("application.contact.workAddress")} + + + + + )} - - -
+ + +