@bloom-housing/ui-components 4.2.3 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/CHANGELOG.md +535 -2
  2. package/README.md +10 -4
  3. package/index.ts +14 -10
  4. package/package.json +6 -4
  5. package/src/actions/Button.docs.mdx +76 -0
  6. package/src/actions/Button.scss +58 -61
  7. package/src/authentication/timeout.tsx +1 -0
  8. package/src/blocks/DashBlock.tsx +5 -3
  9. package/src/blocks/DashBlocks.scss +4 -1
  10. package/src/blocks/FormCard.tsx +1 -1
  11. package/src/forms/FieldGroup.tsx +18 -17
  12. package/src/global/app-css.scss +7 -0
  13. package/src/global/markdown.scss +20 -0
  14. package/src/global/mixins.scss +66 -49
  15. package/src/global/tables.scss +236 -58
  16. package/src/global/text.scss +11 -3
  17. package/src/global/tokens/borders.scss +15 -0
  18. package/src/global/tokens/colors.scss +64 -0
  19. package/src/global/tokens/fonts.scss +45 -0
  20. package/src/global/tokens/screens.scss +6 -0
  21. package/src/global/tokens/sizes.scss +48 -0
  22. package/src/headers/Heading.tsx +2 -0
  23. package/src/headers/PageHeader.docs.mdx +45 -0
  24. package/src/headers/PageHeader.scss +30 -17
  25. package/src/headers/PageHeader.tsx +2 -10
  26. package/src/headers/SiteHeader.tsx +7 -1
  27. package/src/helpers/MultiLineAddress.tsx +37 -0
  28. package/src/helpers/OneLineAddress.tsx +21 -0
  29. package/src/helpers/tableSummaries.tsx +34 -23
  30. package/src/locales/general.json +12 -2
  31. package/src/navigation/FooterNav.scss +8 -3
  32. package/src/overlays/Drawer.tsx +11 -3
  33. package/src/overlays/Modal.tsx +16 -7
  34. package/src/overlays/Overlay.tsx +4 -3
  35. package/src/page_components/ApplicationTimeline.scss +36 -0
  36. package/src/page_components/ApplicationTimeline.tsx +33 -0
  37. package/src/page_components/forgot-password/FormForgotPassword.tsx +5 -4
  38. package/src/page_components/listing/AdditionalFees.tsx +38 -31
  39. package/src/page_components/listing/ListingCard.scss +12 -0
  40. package/src/page_components/listing/ListingCard.tsx +5 -3
  41. package/src/page_components/listing/ListingMap.tsx +7 -2
  42. package/src/page_components/listing/UnitTables.tsx +19 -18
  43. package/src/page_components/listing/listing_sidebar/Contact.tsx +110 -0
  44. package/src/page_components/listing/listing_sidebar/ContactAddress.tsx +41 -0
  45. package/src/page_components/listing/listing_sidebar/GetApplication.tsx +35 -15
  46. package/src/page_components/listing/listing_sidebar/QuantityRowSection.tsx +46 -0
  47. package/src/page_components/listing/listing_sidebar/SubmitApplication.tsx +52 -57
  48. package/src/page_components/listing/listing_sidebar/events/EventSection.tsx +3 -2
  49. package/src/page_components/sign-in/FormSignIn.tsx +2 -1
  50. package/src/page_components/sign-in/ResendConfirmationModal.tsx +106 -0
  51. package/src/prototypes/Swatch.tsx +10 -0
  52. package/src/tables/CategoryTable.tsx +33 -0
  53. package/src/tables/GroupedTable.tsx +5 -5
  54. package/src/tables/MinimalTable.tsx +12 -2
  55. package/src/tables/StackedTable.tsx +38 -26
  56. package/src/tables/StandardTable.tsx +26 -10
  57. package/tailwind.config.js +76 -81
  58. package/tailwind.tosass.js +2 -1
  59. package/src/helpers/address.tsx +0 -46
  60. package/src/page_components/listing/listing_sidebar/LeasingAgent.tsx +0 -72
  61. package/src/page_components/listing/listing_sidebar/SidebarAddress.tsx +0 -56
  62. package/src/page_components/listing/listing_sidebar/Waitlist.tsx +0 -49
@@ -62,8 +62,8 @@ const FormForgotPassword = ({
62
62
  </AlertBox>
63
63
  )}
64
64
 
65
- {!!networkError.error && Object.entries(errors).length === 0 && (
66
- <ErrorMessage id={"householdsize-error"} error={!!networkError.error}>
65
+ {!!networkError.error?.error && Object.entries(errors).length === 0 && (
66
+ <ErrorMessage id={"forgotpasswordemail-error"} error={!!networkError.error}>
67
67
  <AlertBox type="alert" inverted onClose={() => networkError.reset()}>
68
68
  {networkError.error.title}
69
69
  </AlertBox>
@@ -76,7 +76,7 @@ const FormForgotPassword = ({
76
76
 
77
77
  <SiteAlert type="notice" dismissable />
78
78
 
79
- <div className="form-card__group pt-0 border-b">
79
+ <div className="form-card__group pt-0">
80
80
  <Form id="sign-in" className="mt-10" onSubmit={handleSubmit(onSubmit, onError)}>
81
81
  <Field
82
82
  caps={true}
@@ -86,8 +86,9 @@ const FormForgotPassword = ({
86
86
  error={errors.email}
87
87
  errorMessage={errors.email ? t("authentication.signIn.loginError") : undefined}
88
88
  register={register}
89
+ onChange={() => networkError.reset()}
89
90
  />
90
- <section className="bg-gray-300">
91
+ <section>
91
92
  <div className="text-center mt-6">
92
93
  <Button styleType={AppearanceStyleType.primary}>
93
94
  {t("authentication.forgotPassword.sendEmail")}
@@ -1,49 +1,56 @@
1
1
  import * as React from "react"
2
- import { t } from "../../helpers/translator"
3
2
 
4
3
  export interface AdditionalFeesProps {
5
- depositMin?: string
6
- depositMax?: string
4
+ /** The application fee for the property, rendered in the first block */
7
5
  applicationFee?: string
8
- costsNotIncluded?: string
9
- depositHelperText?: string
10
- }
11
-
12
- const AdditionalFees = (props: AdditionalFeesProps) => {
13
- if (!props.depositMin && !props.depositMax && !props.applicationFee && !props.costsNotIncluded) {
14
- return <></>
6
+ /** Costs not included in the deposit or application fee, rendered below both blocks */
7
+ costsNotIncluded?: string | React.ReactNode
8
+ /** The deposit amount for the property, rendered in the second block */
9
+ deposit?: string
10
+ strings: {
11
+ sectionHeader: string
12
+ deposit?: string
13
+ depositSubtext?: string[]
14
+ applicationFee?: string
15
+ applicationFeeSubtext?: string[]
15
16
  }
17
+ }
16
18
 
17
- const getDeposit = () => {
18
- const min = props.depositMin
19
- const max = props.depositMax
20
- if (min && max && min !== max) {
21
- return `$${min} – $${max}`
22
- } else if (min) return `$${min}`
23
- else return `$${max}`
24
- }
19
+ const AdditionalFees = ({
20
+ deposit,
21
+ applicationFee,
22
+ costsNotIncluded,
23
+ strings,
24
+ }: AdditionalFeesProps) => {
25
25
  return (
26
26
  <div className="info-card bg-gray-100 border-0">
27
- <p className="info-card__title">{t("listings.sections.additionalFees")}</p>
27
+ <p className="info-card__title mb-2">{strings.sectionHeader}</p>
28
28
  <div className="info-card__columns text-sm">
29
- {props.applicationFee && (
30
- <div className="info-card__column">
31
- <div className="text-base">{t("listings.applicationFee")}</div>
32
- <div className="text-xl font-bold">${props.applicationFee}</div>
33
- <div>{t("listings.applicationPerApplicantAgeDescription")}</div>
34
- <div>{t("listings.applicationFeeDueAt")}</div>
29
+ {applicationFee && (
30
+ <div className={`info-card__column ${deposit && "mr-2"}`}>
31
+ <div className="text-base">{strings.applicationFee}</div>
32
+ <div className="text-xl font-bold">{applicationFee}</div>
33
+ {strings.applicationFeeSubtext?.map((appFeeSubtext, index) => (
34
+ <div key={index}>{appFeeSubtext}</div>
35
+ ))}
35
36
  </div>
36
37
  )}
37
- {(props.depositMin || props.depositMax) && (
38
- <div className="info-card__column">
39
- <div className="text-base">{t("t.deposit")}</div>
40
- <div className="text-xl font-bold">{getDeposit()}</div>
41
- {props.depositHelperText && <div>{props.depositHelperText}</div>}
38
+ {deposit && (
39
+ <div className={`info-card__column ${applicationFee && "ml-2"}`}>
40
+ <div className="text-base">{strings.deposit}</div>
41
+ <div className="text-xl font-bold">{deposit}</div>
42
+ {strings.depositSubtext?.map((depositSubtext, index) => (
43
+ <div key={index}>{depositSubtext}</div>
44
+ ))}
42
45
  </div>
43
46
  )}
44
47
  </div>
45
48
 
46
- {props.costsNotIncluded && <p className="text-sm mt-6">{props.costsNotIncluded}</p>}
49
+ {costsNotIncluded && (
50
+ <p className={`text-sm mt-2 ${(applicationFee || deposit) && `mt-6`}`}>
51
+ {costsNotIncluded}
52
+ </p>
53
+ )}
47
54
  </div>
48
55
  )
49
56
  }
@@ -19,6 +19,7 @@
19
19
  .listings-row_figure {
20
20
  @apply w-full;
21
21
  @apply p-3;
22
+ @apply pb-0;
22
23
 
23
24
  @screen lg {
24
25
  @apply w-6/12;
@@ -32,6 +33,17 @@
32
33
  @screen lg {
33
34
  @apply w-6/12;
34
35
  }
36
+
37
+ .listings-row_headers {
38
+ @apply flex;
39
+ @apply flex-col;
40
+ @apply items-center;
41
+ @apply text-center;
42
+ @screen md {
43
+ @apply items-start;
44
+ @apply text-left;
45
+ }
46
+ }
35
47
  }
36
48
 
37
49
  .listings-row_table {
@@ -122,8 +122,10 @@ const ListingCard = (props: ListingCardProps) => {
122
122
  (contentProps.contentHeader?.text || contentProps?.contentSubheader?.text) && (
123
123
  <hr className={"mb-2"} />
124
124
  )}
125
- {getHeader(contentProps?.tableHeader, 4, "tableHeader")}
126
- {getHeader(contentProps?.tableSubheader, 5, "tableSubheader")}
125
+ <div className={"listings-row_headers"}>
126
+ {getHeader(contentProps?.tableHeader, 4, "tableHeader")}
127
+ {getHeader(contentProps?.tableSubheader, 5, "tableSubheader")}
128
+ </div>
127
129
  {children && children}
128
130
  {tableProps && (tableProps.data || tableProps.stackedData) && (
129
131
  <>
@@ -159,7 +161,7 @@ const ListingCard = (props: ListingCardProps) => {
159
161
  <ImageCard {...imageCardProps} />
160
162
  </div>
161
163
  <div className="listings-row_content">
162
- <div>{getContentHeader()}</div>
164
+ <div className={"listings-row_headers"}>{getContentHeader()}</div>
163
165
  {getContent()}
164
166
  </div>
165
167
  </article>
@@ -3,8 +3,9 @@ import "mapbox-gl/dist/mapbox-gl.css"
3
3
  import MapGL, { Marker } from "react-map-gl"
4
4
 
5
5
  import "./ListingMap.scss"
6
- import { MultiLineAddress, Address } from "../../helpers/address"
6
+ import { MultiLineAddress, Address } from "../../helpers/MultiLineAddress"
7
7
  import { useIntersect } from "../../.."
8
+ import { Heading } from "../../headers/Heading"
8
9
 
9
10
  export interface ListingMapProps {
10
11
  address?: Address
@@ -107,7 +108,11 @@ const ListingMap = (props: ListingMapProps) => {
107
108
  return (
108
109
  <div className="listing-map" ref={setIntersectingElement}>
109
110
  <div className="addressPopup">
110
- {props.listingName && <h3 className="text-caps-tiny">{props.listingName}</h3>}
111
+ {props.listingName && (
112
+ <Heading priority={3} style={"sidebarSubHeader"}>
113
+ {props.listingName}
114
+ </Heading>
115
+ )}
111
116
  <MultiLineAddress address={props.address} />
112
117
  </div>
113
118
  {(process.env.mapBoxToken || process.env.MAPBOX_TOKEN) && hasIntersected && (
@@ -1,11 +1,10 @@
1
1
  import React from "react"
2
- import { nanoid } from "nanoid"
3
2
  import { MinMax, UnitSummary, Unit } from "@bloom-housing/backend-core/types"
4
3
 
5
- import { StandardTable } from "../../tables/StandardTable"
4
+ import { StandardTable, StandardTableData } from "../../tables/StandardTable"
6
5
  import { t } from "../../helpers/translator"
7
6
  import { numberOrdinal } from "../../helpers/numberOrdinal"
8
- import ContentAccordion from "./ContentAccordion"
7
+ import { ContentAccordion } from "./ContentAccordion"
9
8
 
10
9
  const formatRange = (range: MinMax, ordinalize?: boolean) => {
11
10
  let min: string | number = range.min
@@ -50,24 +49,26 @@ const UnitTables = (props: UnitTablesProps) => {
50
49
  const units = props.units.filter(
51
50
  (unit: Unit) => unit.unitType?.name == unitSummary.unitType.name
52
51
  )
53
- const unitsFormatted = [] as Array<Record<string, React.ReactNode>>
52
+ const unitsFormatted = [] as StandardTableData
54
53
  let floorSection: React.ReactNode
55
54
  units.forEach((unit: Unit) => {
56
55
  unitsFormatted.push({
57
- number: unit.number,
58
- sqFeet: (
59
- <>
60
- {unit.sqFeet ? (
61
- <>
62
- <strong>{parseInt(unit.sqFeet)}</strong> {t("t.sqFeet")}
63
- </>
64
- ) : (
65
- <></>
66
- )}
67
- </>
68
- ),
69
- numBathrooms: <strong>{unit.numBathrooms}</strong>,
70
- floor: <strong>{unit.floor}</strong>,
56
+ number: { content: unit.number },
57
+ sqFeet: {
58
+ content: (
59
+ <>
60
+ {unit.sqFeet ? (
61
+ <>
62
+ <strong>{parseInt(unit.sqFeet)}</strong> {t("t.sqFeet")}
63
+ </>
64
+ ) : (
65
+ <></>
66
+ )}
67
+ </>
68
+ ),
69
+ },
70
+ numBathrooms: { content: <strong>{unit.numBathrooms}</strong> },
71
+ floor: { content: <strong>{unit.floor}</strong> },
71
72
  })
72
73
  })
73
74
 
@@ -0,0 +1,110 @@
1
+ import * as React from "react"
2
+ import { ContactAddress } from "./ContactAddress"
3
+ import { Icon, IconFillColors } from "../../../icons/Icon"
4
+ import { Address } from "../../../helpers/MultiLineAddress"
5
+ import { Heading } from "../../../headers/Heading"
6
+
7
+ export interface ContactProps {
8
+ /** Any number of text sections rendered after the contact information */
9
+ additionalInformation?: { title: string; content: string | React.ReactNode }[]
10
+ /** The contact's address */
11
+ contactAddress?: Address
12
+ /** The contact's company and website */
13
+ contactCompany?: { name: string; website: string }
14
+ /** The contact's email */
15
+ contactEmail?: string
16
+ /** The contact's name */
17
+ contactName?: string
18
+ /** The contact's phone number */
19
+ contactPhoneNumber?: string
20
+ /** Additional information pertaining to the contact's phone number */
21
+ contactPhoneNumberNote?: string
22
+ /** The contact's title */
23
+ contactTitle?: string
24
+ /** The text for the section's header */
25
+ sectionTitle: string
26
+ strings: { email?: string; getDirections: string; website?: string }
27
+ }
28
+
29
+ /** Displays information about a contact, including their address, contact information, and notes */
30
+ const Contact = ({
31
+ additionalInformation,
32
+ contactAddress,
33
+ contactCompany,
34
+ contactEmail,
35
+ contactName,
36
+ contactPhoneNumber,
37
+ contactPhoneNumberNote,
38
+ contactTitle,
39
+ sectionTitle,
40
+ strings,
41
+ }: ContactProps) => {
42
+ const formattedPhoneLink = contactPhoneNumber
43
+ ? `tel:${contactPhoneNumber.replace(/[-()]/g, "")}`
44
+ : undefined
45
+ const formattedCompanyWebsite =
46
+ contactCompany?.website && !contactCompany?.website.startsWith("http")
47
+ ? `http://${contactCompany?.website}`
48
+ : contactCompany?.website
49
+
50
+ return (
51
+ <section className="aside-block">
52
+ <Heading priority={4} style={"sidebarHeader"}>
53
+ {sectionTitle}
54
+ </Heading>
55
+
56
+ {contactName && <p className="text-xl">{contactName}</p>}
57
+ {contactTitle && <p className="text-gray-700">{contactTitle}</p>}
58
+ {contactCompany?.name && <p className="text-gray-700">{contactCompany.name}</p>}
59
+
60
+ {contactPhoneNumber && (
61
+ <>
62
+ <p className="mt-3">
63
+ <a href={formattedPhoneLink}>
64
+ <Icon symbol="phone" size="medium" fill={IconFillColors.primary} className={"pr-2"} />
65
+ {contactPhoneNumber}
66
+ </a>
67
+ </p>
68
+ {contactPhoneNumberNote && (
69
+ <p className="text-sm text-gray-700">{contactPhoneNumberNote}</p>
70
+ )}
71
+ </>
72
+ )}
73
+
74
+ {contactEmail && (
75
+ <p className="my-3">
76
+ <a href={`mailto:${contactEmail}`}>
77
+ <Icon symbol="mail" size="medium" fill={IconFillColors.primary} className={"pr-2"} />
78
+ {strings?.email && strings?.email}
79
+ </a>
80
+ </p>
81
+ )}
82
+
83
+ {formattedCompanyWebsite && (
84
+ <p className="my-3">
85
+ <a href={formattedCompanyWebsite} target="_blank" rel="noreferrer noopener">
86
+ <Icon symbol="globe" size="medium" fill={IconFillColors.primary} className={"pr-2"} />
87
+ {strings?.website && strings?.website}
88
+ </a>
89
+ </p>
90
+ )}
91
+
92
+ {contactAddress && (
93
+ <ContactAddress address={contactAddress} mapString={strings.getDirections} />
94
+ )}
95
+
96
+ {additionalInformation?.map((info) => {
97
+ return (
98
+ <>
99
+ <Heading priority={3} style={"sidebarSubHeader"}>
100
+ {info.title}
101
+ </Heading>
102
+ <div className="text-gray-800 text-tiny markdown">{info.content}</div>
103
+ </>
104
+ )
105
+ })}
106
+ </section>
107
+ )
108
+ }
109
+
110
+ export { Contact as default, Contact }
@@ -0,0 +1,41 @@
1
+ import * as React from "react"
2
+ import ReactDOMServer from "react-dom/server"
3
+ import { Icon, IconFillColors } from "../../../icons/Icon"
4
+ import { MultiLineAddress, Address } from "../../../helpers/MultiLineAddress"
5
+ import { OneLineAddress } from "../../../helpers/OneLineAddress"
6
+
7
+ export interface ContactAddressProps {
8
+ /** An address */
9
+ address: Address
10
+ /** A string for the map link */
11
+ mapString: string
12
+ }
13
+
14
+ /** Renders an address followed by a Google Maps link to the address */
15
+ const ContactAddress = ({ address, mapString }: ContactAddressProps) => {
16
+ if (!address?.street) return null
17
+
18
+ const oneLineAddress = <OneLineAddress address={address} />
19
+ const mainAddress = <MultiLineAddress address={address} />
20
+ const googleMapsHref =
21
+ "https://www.google.com/maps/place/" + ReactDOMServer.renderToStaticMarkup(oneLineAddress)
22
+
23
+ return (
24
+ <>
25
+ <p className="text-gray-700 mb-1">{mainAddress}</p>
26
+ <p className="mb-4">
27
+ <a
28
+ href={googleMapsHref}
29
+ className="inline-block pt-1"
30
+ target="_blank"
31
+ rel="noreferrer noopener"
32
+ >
33
+ <Icon symbol="map" size="medium" fill={IconFillColors.primary} className={"pr-2"} />
34
+ {mapString}
35
+ </a>
36
+ </p>
37
+ </>
38
+ )
39
+ }
40
+
41
+ export { ContactAddress as default, ContactAddress }
@@ -3,10 +3,11 @@ import { t } from "../../../helpers/translator"
3
3
  import { Button } from "../../../actions/Button"
4
4
  import { LinkButton } from "../../../actions/LinkButton"
5
5
  import { AppearanceStyleType } from "../../../global/AppearanceTypes"
6
- import { Address } from "../../../helpers/address"
7
- import { SidebarAddress } from "./SidebarAddress"
6
+ import { Address } from "../../../helpers/MultiLineAddress"
7
+ import { ContactAddress } from "./ContactAddress"
8
8
  import { OrDivider } from "./OrDivider"
9
- import { ListingStatus } from "@bloom-housing/backend-core/types"
9
+ import { Heading } from "../../../headers/Heading"
10
+ import Markdown from "markdown-to-jsx"
10
11
 
11
12
  export interface PaperApplication {
12
13
  fileURL: string
@@ -14,26 +15,30 @@ export interface PaperApplication {
14
15
  }
15
16
 
16
17
  export interface ApplicationsProps {
17
- onlineApplicationURL?: string
18
+ /** The pickup address for the application */
19
+ applicationPickUpAddress?: Address
20
+ /** Office hours for the agent at the pickup address */
21
+ applicationPickUpAddressOfficeHours?: string
22
+ /** Whether or not applications are currently open */
18
23
  applicationsOpen: boolean
24
+ /** The date applications open */
19
25
  applicationsOpenDate?: string
26
+ /** The URL for an online applications */
27
+ onlineApplicationURL?: string
28
+ /** Any number of paper application objects, including their URL and language */
20
29
  paperApplications?: PaperApplication[]
30
+ /** Whether or not there is a paper application method */
21
31
  paperMethod?: boolean
32
+ /** The date mailed applications must be received by */
22
33
  postmarkedApplicationsReceivedByDate?: string
23
- applicationPickUpAddressOfficeHours?: string
24
- applicationPickUpAddress?: Address
34
+ /** Whether or not to hide actionable application buttons */
25
35
  preview?: boolean
26
- listingStatus?: ListingStatus
27
36
  }
28
-
37
+ /** Displays information regarding how to apply, including an online application link button, paper application downloads, and a paper application pickup address */
29
38
  const GetApplication = (props: ApplicationsProps) => {
30
39
  const [showDownload, setShowDownload] = useState(false)
31
40
  const toggleDownload = () => setShowDownload(!showDownload)
32
41
 
33
- if (props.listingStatus === ListingStatus.closed) {
34
- return null
35
- }
36
-
37
42
  return (
38
43
  <section className="aside-block">
39
44
  <h2 className="text-caps-underline">{t("listings.apply.howToApply")}</h2>
@@ -95,11 +100,26 @@ const GetApplication = (props: ApplicationsProps) => {
95
100
  {props.applicationsOpen && (props.onlineApplicationURL || props.paperMethod) && (
96
101
  <OrDivider bgColor="white" />
97
102
  )}
98
- <h3 className="text-caps-tiny">{t("listings.apply.pickUpAnApplication")}</h3>
99
- <SidebarAddress
103
+ <Heading priority={3} style={"sidebarSubHeader"}>
104
+ {t("listings.apply.pickUpAnApplication")}
105
+ </Heading>
106
+ <ContactAddress
100
107
  address={props.applicationPickUpAddress}
101
- officeHours={props.applicationPickUpAddressOfficeHours}
108
+ mapString={t("t.getDirections")}
102
109
  />
110
+ {props.applicationPickUpAddressOfficeHours && (
111
+ <>
112
+ <Heading priority={3} style={"sidebarSubHeader"}>
113
+ {t("leasingAgent.officeHours")}
114
+ </Heading>
115
+ <p className="text-gray-800 text-tiny markdown">
116
+ <Markdown
117
+ children={props.applicationPickUpAddressOfficeHours}
118
+ options={{ disableParsingRawHTML: true }}
119
+ />
120
+ </p>
121
+ </>
122
+ )}
103
123
  </>
104
124
  )}
105
125
  </section>
@@ -0,0 +1,46 @@
1
+ import * as React from "react"
2
+
3
+ export interface QuantityRow {
4
+ amount: number | null
5
+ text: string
6
+ emphasized?: boolean
7
+ }
8
+
9
+ export interface QuantityRowSectionProps {
10
+ /** Any amount of number/text combinations, rendered in a list */
11
+ quantityRows: QuantityRow[]
12
+ strings: {
13
+ sectionTitle: string
14
+ description?: string | React.ReactNode
15
+ }
16
+ }
17
+
18
+ const QuantityRowSection = ({ quantityRows, strings }: QuantityRowSectionProps) => {
19
+ const getRow = (row: QuantityRow) => {
20
+ return (
21
+ <li
22
+ key={row.text}
23
+ className={`uppercase text-gray-800 ${
24
+ row.emphasized ? "font-bold" : "font-normal"
25
+ } font-alt-sans leading-7`}
26
+ >
27
+ <span className="text-right w-12 inline-block pr-2.5 text-base">{row.amount}</span>
28
+ <span className={"text-sm"}>{row.text}</span>
29
+ </li>
30
+ )
31
+ }
32
+
33
+ return (
34
+ <section className="aside-block is-tinted">
35
+ <h4 className="text-caps-tiny">{strings.sectionTitle}</h4>
36
+ <div>
37
+ {strings.description && (
38
+ <p className="text-tiny text-gray-800 pb-3">{strings.description}</p>
39
+ )}
40
+ {quantityRows.length && <ul>{quantityRows.map((row) => getRow(row))}</ul>}
41
+ </div>
42
+ </section>
43
+ )
44
+ }
45
+
46
+ export { QuantityRowSection as default, QuantityRowSection }
@@ -1,78 +1,73 @@
1
1
  import * as React from "react"
2
- import { t } from "../../../helpers/translator"
3
- import { Address } from "../../../helpers/address"
4
- import { SidebarAddress } from "./SidebarAddress"
2
+ import Markdown from "markdown-to-jsx"
3
+ import { Address } from "../../../helpers/MultiLineAddress"
4
+ import { ContactAddress } from "./ContactAddress"
5
5
  import { OrDivider } from "./OrDivider"
6
- import { ListingStatus } from "@bloom-housing/backend-core/types"
7
-
8
- export interface PostmarkedApplication {
9
- postmarkedApplicationsReceivedByDate: string | null
10
- developer: string
11
- applicationsDueDate: string | null
12
- }
6
+ import { Heading } from "../../../headers/Heading"
13
7
 
14
8
  export interface ApplicationAddressesProps {
15
- applicationMailingAddress?: Address
9
+ /** The dropoff address for paper applications */
16
10
  applicationDropOffAddress?: Address
11
+ /** Office hours for developers at the dropoff address for paper applications */
17
12
  applicationDropOffAddressOfficeHours?: string
13
+ /** The mailing address for paper applications */
14
+ applicationMailingAddress?: Address
15
+ /** The application organization, often the developer */
18
16
  applicationOrganization?: string
19
- postmarkedApplicationData?: PostmarkedApplication
20
- listingStatus?: ListingStatus
21
- }
22
-
23
- const SubmitApplication = (props: ApplicationAddressesProps) => {
24
- if (
25
- props.listingStatus === ListingStatus.closed ||
26
- !(props.applicationMailingAddress || props.applicationDropOffAddress)
27
- ) {
28
- return null
29
- }
30
-
31
- const getPostmarkString = () => {
32
- const applicationDueDate = props.postmarkedApplicationData?.applicationsDueDate
33
- const postmarkReceivedByDate =
34
- props.postmarkedApplicationData?.postmarkedApplicationsReceivedByDate
35
- const developer = props.postmarkedApplicationData?.developer
36
- if (applicationDueDate) {
37
- return postmarkReceivedByDate
38
- ? t("listings.apply.submitPaperDueDatePostMark", {
39
- applicationDueDate,
40
- postmarkReceivedByDate,
41
- developer,
42
- })
43
- : t("listings.apply.submitPaperDueDateNoPostMark", {
44
- applicationDueDate,
45
- developer,
46
- })
47
- } else {
48
- return postmarkReceivedByDate
49
- ? t("listings.apply.submitPaperNoDueDatePostMark", { postmarkReceivedByDate, developer })
50
- : t("listings.apply.submitPaperNoDueDateNoPostMark", { developer })
51
- }
17
+ strings: {
18
+ postmark?: string
19
+ mailHeader?: string
20
+ sectionHeader?: string
21
+ dropOffHeader?: string
22
+ officeHoursHeader?: string
23
+ mapString: string
52
24
  }
25
+ }
53
26
 
27
+ /** Displays information regarding paper applications, including two sections: (1) how to mail in applications and (2) how to drop off applications */
28
+ const SubmitApplication = ({
29
+ applicationDropOffAddress,
30
+ applicationDropOffAddressOfficeHours,
31
+ applicationMailingAddress,
32
+ applicationOrganization,
33
+ strings,
34
+ }: ApplicationAddressesProps) => {
54
35
  return (
55
36
  <>
56
37
  <section className="aside-block is-tinted bg-gray-100">
57
- <div className="text-serif-lg">{t("listings.apply.submitAPaperApplication")}</div>
58
- {props.applicationMailingAddress && (
38
+ <div className="text-serif-lg">{strings.sectionHeader}</div>
39
+ {applicationMailingAddress && (
59
40
  <>
60
- <h3 className="text-caps-tiny">{t("listings.apply.sendByUsMail")}</h3>
41
+ <Heading priority={3} style={"sidebarSubHeader"}>
42
+ {strings.mailHeader}
43
+ </Heading>
61
44
  <>
62
- <p className="text-gray-700">{props.applicationOrganization}</p>
63
- <SidebarAddress address={props.applicationMailingAddress} />
45
+ <p className="text-gray-700">{applicationOrganization}</p>
46
+ <ContactAddress address={applicationMailingAddress} mapString={strings.mapString} />
64
47
  </>
65
- <p className="mt-4 text-tiny text-gray-750">{getPostmarkString()}</p>
48
+ {strings.postmark && <p className="mt-4 text-tiny text-gray-750">{strings.postmark}</p>}
66
49
  </>
67
50
  )}
68
- {props.applicationDropOffAddress && (
51
+ {applicationDropOffAddress && (
69
52
  <>
70
- {props.applicationMailingAddress && <OrDivider bgColor="gray-100" />}
71
- <h3 className="text-caps-tiny">{t("listings.apply.dropOffApplication")}</h3>
72
- <SidebarAddress
73
- address={props.applicationDropOffAddress}
74
- officeHours={props.applicationDropOffAddressOfficeHours}
75
- />
53
+ {applicationMailingAddress && <OrDivider bgColor="gray-100" />}
54
+ <Heading priority={3} style={"sidebarSubHeader"}>
55
+ {strings.dropOffHeader}
56
+ </Heading>
57
+ <ContactAddress address={applicationDropOffAddress} mapString={strings.mapString} />
58
+ {applicationDropOffAddressOfficeHours && (
59
+ <>
60
+ <Heading priority={3} style={"sidebarSubHeader"}>
61
+ {strings.officeHoursHeader}
62
+ </Heading>
63
+ <p className="mt-4 text-tiny text-gray-750">
64
+ <Markdown
65
+ children={applicationDropOffAddressOfficeHours}
66
+ options={{ disableParsingRawHTML: true }}
67
+ />
68
+ </p>
69
+ </>
70
+ )}
76
71
  </>
77
72
  )}
78
73
  </section>