@bloom-housing/ui-components 4.2.2-alpha.22 → 4.2.2-alpha.23

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [4.2.2-alpha.23](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@4.2.2-alpha.22...@bloom-housing/ui-components@4.2.2-alpha.23) (2022-05-04)
7
+
8
+
9
+ ### Code Refactoring
10
+
11
+ * remove business logic, strings from waitlist component ([#2689](https://github.com/bloom-housing/bloom/issues/2689)) ([a5721db](https://github.com/bloom-housing/bloom/commit/a5721db518453ddbd777e50ca92fdeac19997aa9))
12
+
13
+
14
+ ### BREAKING CHANGES
15
+
16
+ * the Waitlist component was renamed to QuantityRowSection which also has a new prop set to account for a flexible number of rows and strings
17
+
18
+
19
+
20
+
21
+
6
22
  ## [4.2.2-alpha.22](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@4.2.2-alpha.21...@bloom-housing/ui-components@4.2.2-alpha.22) (2022-05-03)
7
23
 
8
24
 
package/index.ts CHANGED
@@ -115,7 +115,7 @@ export * from "./src/page_components/listing/listing_sidebar/OrDivider"
115
115
  export * from "./src/page_components/listing/listing_sidebar/ReferralApplication"
116
116
  export * from "./src/page_components/listing/listing_sidebar/SidebarAddress"
117
117
  export * from "./src/page_components/listing/listing_sidebar/SubmitApplication"
118
- export * from "./src/page_components/listing/listing_sidebar/Waitlist"
118
+ export * from "./src/page_components/listing/listing_sidebar/QuantityRowSection"
119
119
  export * from "./src/page_components/listing/listing_sidebar/WhatToExpect"
120
120
  export * from "./src/page_components/listing/listing_sidebar/events/DownloadLotteryResults"
121
121
  export * from "./src/page_components/listing/listing_sidebar/events/EventSection"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bloom-housing/ui-components",
3
- "version": "4.2.2-alpha.22",
3
+ "version": "4.2.2-alpha.23",
4
4
  "author": "Sean Albert <sean.albert@exygy.com>",
5
5
  "description": "Shared user interface components for Bloom affordable housing system",
6
6
  "homepage": "https://github.com/bloom-housing/bloom/tree/master/shared/ui-components",
@@ -102,5 +102,5 @@
102
102
  "tailwindcss": "2.2.10",
103
103
  "typesafe-actions": "^5.1.0"
104
104
  },
105
- "gitHead": "d1e92b646c2942546756f80fecbb624a3e74b1b0"
105
+ "gitHead": "004be94722a0b7bccd6fa7528f2a0be2a5e8529b"
106
106
  }
@@ -89,7 +89,7 @@ h1.title {
89
89
 
90
90
  .text-caps-tiny {
91
91
  @apply mb-4;
92
- @apply text-gray-700;
92
+ @apply text-gray-750;
93
93
  @apply uppercase;
94
94
  @apply font-sans;
95
95
  @apply font-bold;
@@ -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,49 +0,0 @@
1
- import * as React from "react"
2
- import { t } from "../../../helpers/translator"
3
-
4
- export interface WaitlistProps {
5
- isWaitlistOpen: boolean
6
- waitlistMaxSize?: number | null
7
- waitlistCurrentSize?: number | null
8
- waitlistOpenSpots?: number | null
9
- }
10
-
11
- const WaitlistItem = (props: { className?: string; value: number; text: string }) => (
12
- <li className={`uppercase text-gray-800 text-tiny ${props.className}`}>
13
- <span className="text-right w-12 inline-block pr-2">{props.value}</span>
14
- <span>{props.text}</span>
15
- </li>
16
- )
17
-
18
- const Waitlist = (props: WaitlistProps) => {
19
- if (!props.isWaitlistOpen) return <></>
20
-
21
- return (
22
- <section className="aside-block is-tinted">
23
- <h4 className="text-caps-tiny">{t("listings.waitlist.unitsAndWaitlist")}</h4>
24
- <div>
25
- <p className="text-tiny text-gray-800 pb-3">{t("listings.waitlist.submitAnApplication")}</p>
26
- <ul>
27
- {props.waitlistCurrentSize !== null && props.waitlistCurrentSize !== undefined && (
28
- <WaitlistItem
29
- value={props.waitlistCurrentSize}
30
- text={t("listings.waitlist.currentSize")}
31
- />
32
- )}
33
- {props.waitlistOpenSpots !== null && props.waitlistOpenSpots !== undefined && (
34
- <WaitlistItem
35
- value={props.waitlistOpenSpots}
36
- text={t("listings.waitlist.openSlots")}
37
- className={"font-semibold"}
38
- />
39
- )}
40
- {props.waitlistMaxSize != null && (
41
- <WaitlistItem value={props.waitlistMaxSize} text={t("listings.waitlist.finalSize")} />
42
- )}
43
- </ul>
44
- </div>
45
- </section>
46
- )
47
- }
48
-
49
- export { Waitlist as default, Waitlist }