@bloom-housing/ui-components 4.0.1-alpha.60 → 4.0.1-alpha.64

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,46 @@
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.0.1-alpha.64](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@4.0.1-alpha.63...@bloom-housing/ui-components@4.0.1-alpha.64) (2022-02-16)
7
+
8
+ **Note:** Version bump only for package @bloom-housing/ui-components
9
+
10
+
11
+
12
+
13
+
14
+ ## [4.0.1-alpha.63](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@4.0.1-alpha.62...@bloom-housing/ui-components@4.0.1-alpha.63) (2022-02-15)
15
+
16
+ **Note:** Version bump only for package @bloom-housing/ui-components
17
+
18
+
19
+
20
+
21
+
22
+ ## [4.0.1-alpha.62](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@4.0.1-alpha.61...@bloom-housing/ui-components@4.0.1-alpha.62) (2022-02-15)
23
+
24
+
25
+ ### Code Refactoring
26
+
27
+ * remove backend dependencies from events components, consolidate ([#2495](https://github.com/bloom-housing/bloom/issues/2495)) ([d884689](https://github.com/bloom-housing/bloom/commit/d88468965bc67c74b8b3eaced20c77472e90331f))
28
+
29
+
30
+ ### BREAKING CHANGES
31
+
32
+ * consolidated all event section components in one new component, uptake will require removing the deprecated components and uptaking EventSection
33
+
34
+
35
+
36
+
37
+
38
+ ## [4.0.1-alpha.61](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@4.0.1-alpha.60...@bloom-housing/ui-components@4.0.1-alpha.61) (2022-02-15)
39
+
40
+ **Note:** Version bump only for package @bloom-housing/ui-components
41
+
42
+
43
+
44
+
45
+
6
46
  ## [4.0.1-alpha.60](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@4.0.1-alpha.59...@bloom-housing/ui-components@4.0.1-alpha.60) (2022-02-15)
7
47
 
8
48
  **Note:** Version bump only for package @bloom-housing/ui-components
package/index.ts CHANGED
@@ -116,10 +116,7 @@ export * from "./src/page_components/listing/listing_sidebar/SubmitApplication"
116
116
  export * from "./src/page_components/listing/listing_sidebar/Waitlist"
117
117
  export * from "./src/page_components/listing/listing_sidebar/WhatToExpect"
118
118
  export * from "./src/page_components/listing/listing_sidebar/events/DownloadLotteryResults"
119
- export * from "./src/page_components/listing/listing_sidebar/events/OpenHouseEvent"
120
- export * from "./src/page_components/listing/listing_sidebar/events/LotteryResultsEvent"
121
- export * from "./src/page_components/listing/listing_sidebar/events/PublicLotteryEvent"
122
- export * from "./src/page_components/listing/listing_sidebar/events/EventDateSection"
119
+ export * from "./src/page_components/listing/listing_sidebar/events/EventSection"
123
120
  export * from "./src/page_components/sign-in/FormSignIn"
124
121
  export * from "./src/page_components/sign-in/FormSignInMFAType"
125
122
  export * from "./src/page_components/sign-in/FormSignInMFACode"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bloom-housing/ui-components",
3
- "version": "4.0.1-alpha.60",
3
+ "version": "4.0.1-alpha.64",
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",
@@ -69,7 +69,7 @@
69
69
  "webpack": "^4.44.2"
70
70
  },
71
71
  "dependencies": {
72
- "@bloom-housing/backend-core": "^3.0.2-alpha.36",
72
+ "@bloom-housing/backend-core": "^3.0.2-alpha.40",
73
73
  "@mapbox/mapbox-sdk": "^0.13.0",
74
74
  "@types/body-scroll-lock": "^2.6.1",
75
75
  "@types/jwt-decode": "^2.2.1",
@@ -100,5 +100,5 @@
100
100
  "tailwindcss": "2.2.10",
101
101
  "typesafe-actions": "^5.1.0"
102
102
  },
103
- "gitHead": "00873ac2f24b78827a5cc1a2e93b152fb5ee53f0"
103
+ "gitHead": "261a2bb1de4728243df9e3be57471769662be4a6"
104
104
  }
@@ -1,30 +1,29 @@
1
1
  import * as React from "react"
2
- import { ListingEvent } from "@bloom-housing/backend-core/types"
3
2
  import { t } from "../../../../helpers/translator"
4
- import dayjs from "dayjs"
5
3
 
6
- const DownloadLotteryResults = (props: { event: ListingEvent; pdfUrl: string }) => {
7
- const { event, pdfUrl } = props
8
- const eventUrl = event ? pdfUrl : null
4
+ type DownloadLotteryResultsProps = {
5
+ resultsDate?: string
6
+ buttonText?: string
7
+ pdfURL?: string
8
+ }
9
+
10
+ const DownloadLotteryResults = (props: DownloadLotteryResultsProps) => {
11
+ if (!props.pdfURL) return null
9
12
  return (
10
- <>
11
- {eventUrl && (
12
- <section className="aside-block text-center">
13
- <h2 className="text-caps pb-4">{t("listings.lotteryResults.header")}</h2>
14
- <p className="uppercase text-gray-800 text-tiny font-semibold pb-4">
15
- {dayjs(event.startTime).format("MMMM D, YYYY")}
16
- </p>
17
- <a
18
- className="button is-primary w-full mb-2"
19
- href={eventUrl}
20
- title={t("listings.lotteryResults.downloadResults")}
21
- target="_blank"
22
- >
23
- {t("listings.lotteryResults.downloadResults")}
24
- </a>
25
- </section>
13
+ <section className="aside-block text-center">
14
+ <h2 className="text-caps pb-4">{t("listings.lotteryResults.header")}</h2>
15
+ {props.resultsDate && (
16
+ <p className="uppercase text-gray-800 text-tiny font-semibold pb-4">{props.resultsDate}</p>
26
17
  )}
27
- </>
18
+ <a
19
+ className="button is-primary w-full mb-2"
20
+ href={props.pdfURL}
21
+ title={props.buttonText}
22
+ target="_blank"
23
+ >
24
+ {props.buttonText ?? t("listings.lotteryResults.downloadResults")}
25
+ </a>
26
+ </section>
28
27
  )
29
28
  }
30
29
 
@@ -0,0 +1,54 @@
1
+ import * as React from "react"
2
+
3
+ export type EventType = {
4
+ timeString?: string
5
+ dateString?: string
6
+ linkURL?: string
7
+ linkText?: string
8
+ note?: string | React.ReactNode
9
+ }
10
+
11
+ type EventSectionProps = {
12
+ events: EventType[]
13
+ headerText?: string
14
+ sectionHeader?: boolean
15
+ }
16
+
17
+ const EventSection = (props: EventSectionProps) => {
18
+ if (!props.events.length) return null
19
+ return (
20
+ <section className="aside-block">
21
+ {props.headerText && (
22
+ <h4 className={props.sectionHeader ? "text-caps-underline" : "text-caps-tiny"}>
23
+ {props.headerText}
24
+ </h4>
25
+ )}
26
+ {props.events.map((event, index) => (
27
+ <div key={`events-${index}`} className={`${index !== props.events.length - 1 && "pb-3"}`}>
28
+ {event.dateString && (
29
+ <p className="text text-gray-800 pb-2 flex justify-between items-center">
30
+ <span className="inline-block text-tiny uppercase">{event.dateString}</span>
31
+ {event.timeString && (
32
+ <span className="inline-block text-sm font-bold ml-5 font-alt-sans">
33
+ {event.timeString}
34
+ </span>
35
+ )}
36
+ </p>
37
+ )}
38
+ {event.linkURL && event.linkText && (
39
+ <p className="pb-2 text-tiny">
40
+ <a href={event.linkURL}>{event.linkText}</a>
41
+ </p>
42
+ )}
43
+ {event.note && (
44
+ <p className={`text-tiny text-gray-700 ${index !== props.events.length - 1 && "pb-3"}`}>
45
+ {event.note}
46
+ </p>
47
+ )}
48
+ </div>
49
+ ))}
50
+ </section>
51
+ )
52
+ }
53
+
54
+ export { EventSection as default, EventSection }
@@ -1,25 +0,0 @@
1
- import * as React from "react"
2
- import { ListingEvent } from "@bloom-housing/backend-core/types"
3
- import dayjs from "dayjs"
4
-
5
- const EventDateSection = (props: { event: ListingEvent }) => {
6
- const getRangeString = () => {
7
- const startTime = dayjs(props.event.startTime).format("hh:mma")
8
- const endTime = dayjs(props.event.endTime).format("hh:mma")
9
- return startTime === endTime ? startTime : `${startTime} - ${endTime}`
10
- }
11
- return (
12
- <>
13
- {props.event.startTime && (
14
- <p className="text text-gray-800 pb-3 flex justify-between items-center">
15
- <span className="inline-block text-tiny uppercase">
16
- {dayjs(props.event.startTime).format("MMMM D, YYYY")}
17
- </span>
18
- <span className="inline-block text-sm font-bold">{getRangeString()}</span>
19
- </p>
20
- )}
21
- </>
22
- )
23
- }
24
-
25
- export { EventDateSection as default, EventDateSection }
@@ -1,26 +0,0 @@
1
- import * as React from "react"
2
- import { ListingEvent } from "@bloom-housing/backend-core/types"
3
- import { t } from "../../../../helpers/translator"
4
- import dayjs from "dayjs"
5
-
6
- const LotteryResultsEvent = (props: { event: ListingEvent }) => {
7
- const { event } = props
8
- return (
9
- <section className="aside-block">
10
- <h4 className="text-caps-underline">{t("listings.lotteryResults.header")}</h4>
11
- <p className="text text-gray-800 pb-3 flex justify-between items-center">
12
- <span className="inline-block">{dayjs(props.event.startTime).format("MMMM D, YYYY")}</span>
13
- </p>
14
- {event.note && <p className="text text-gray-600">{event.note}</p>}
15
- {!event.note && (
16
- <p className="text-tiny text-gray-600">
17
- {t("listings.lotteryResults.completeResultsWillBePosted", {
18
- hour: dayjs(props.event.startTime).format("h a"),
19
- })}
20
- </p>
21
- )}
22
- </section>
23
- )
24
- }
25
-
26
- export { LotteryResultsEvent as default, LotteryResultsEvent }
@@ -1,27 +0,0 @@
1
- import * as React from "react"
2
- import { ListingEvent } from "@bloom-housing/backend-core/types"
3
- import { EventDateSection } from "./EventDateSection"
4
- import { t } from "../../../../helpers/translator"
5
-
6
- const OpenHouseEvent = (props: { events: ListingEvent[] }) => {
7
- return (
8
- <section className="aside-block">
9
- <h4 className="text-caps-tiny">{t("listings.openHouseEvent.header")}</h4>
10
- {props.events.map((openHouseEvent, index) => (
11
- <div key={`openHouses-${index}`}>
12
- <EventDateSection event={openHouseEvent} />
13
- {openHouseEvent.url && (
14
- <p className="text text-gray-800 pb-3">
15
- <a href={openHouseEvent.url}>
16
- {openHouseEvent.label || t("listings.openHouseEvent.seeVideo")}
17
- </a>
18
- </p>
19
- )}
20
- {openHouseEvent.note && <p className="text-tiny text-gray-600">{openHouseEvent.note}</p>}
21
- </div>
22
- ))}
23
- </section>
24
- )
25
- }
26
-
27
- export { OpenHouseEvent as default, OpenHouseEvent }
@@ -1,22 +0,0 @@
1
- import * as React from "react"
2
- import { ListingEvent } from "@bloom-housing/backend-core/types"
3
- import { t } from "../../../../helpers/translator"
4
- import { EventDateSection } from "./EventDateSection"
5
-
6
- const PublicLotteryEvent = (props: { event: ListingEvent }) => {
7
- const { event } = props
8
- return (
9
- <section className="aside-block">
10
- <h4 className="text-caps-underline">{t("listings.publicLottery.header")}</h4>
11
- <EventDateSection event={props.event} />
12
- {event.url && (
13
- <p className="text text-gray-800 pb-3">
14
- <a href={event.url}>{t("listings.publicLottery.seeVideo")}</a>
15
- </p>
16
- )}
17
- {event.note && <p className="text-tiny text-gray-600">{event.note}</p>}
18
- </section>
19
- )
20
- }
21
-
22
- export { PublicLotteryEvent as default, PublicLotteryEvent }