@bloom-housing/ui-components 5.0.1-alpha.5 → 5.0.1-alpha.8

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,36 @@
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
+ ## [5.0.1-alpha.8](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@5.0.1-alpha.7...@bloom-housing/ui-components@5.0.1-alpha.8) (2022-07-06)
7
+
8
+ **Note:** Version bump only for package @bloom-housing/ui-components
9
+
10
+
11
+
12
+
13
+
14
+ ## [5.0.1-alpha.7](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@5.0.1-alpha.6...@bloom-housing/ui-components@5.0.1-alpha.7) (2022-07-02)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * switch back to padding for image card leader ([#2851](https://github.com/bloom-housing/bloom/issues/2851)) ([c3fde4a](https://github.com/bloom-housing/bloom/commit/c3fde4adbff2bd116c4acaf39f609d3c0ed0638f))
20
+
21
+
22
+
23
+
24
+
25
+ ## [5.0.1-alpha.6](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@5.0.1-alpha.5...@bloom-housing/ui-components@5.0.1-alpha.6) (2022-06-29)
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * hide apply section if there is no data ([#2846](https://github.com/bloom-housing/bloom/issues/2846)) ([5fcaf58](https://github.com/bloom-housing/bloom/commit/5fcaf58acc8cc083c738f53a23beba4e567b2994))
31
+
32
+
33
+
34
+
35
+
6
36
  ## [5.0.1-alpha.5](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@5.0.1-alpha.4...@bloom-housing/ui-components@5.0.1-alpha.5) (2022-06-27)
7
37
 
8
38
 
package/index.ts CHANGED
@@ -82,6 +82,7 @@ export * from "./src/navigation/LanguageNav"
82
82
  export * from "./src/navigation/ProgressNav"
83
83
  export * from "./src/navigation/TabNav"
84
84
  export * from "./src/navigation/Tabs"
85
+ export * from "./src/navigation/Breadcrumbs"
85
86
 
86
87
  /* Notifications */
87
88
  export * from "./src/notifications/AlertBox"
@@ -128,6 +129,7 @@ export * from "./src/page_components/sign-in/FormSignInMFACode"
128
129
  export * from "./src/page_components/sign-in/FormSignInAddPhone"
129
130
  export * from "./src/page_components/sign-in/FormSignInErrorBox"
130
131
  export * from "./src/page_components/forgot-password/FormForgotPassword"
132
+ export * from "./src/page_components/NavigationHeader"
131
133
 
132
134
  /* Responsive Wrappers */
133
135
  export * from "./src/sections/ResponsiveWrappers"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bloom-housing/ui-components",
3
- "version": "5.0.1-alpha.5",
3
+ "version": "5.0.1-alpha.8",
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",
@@ -108,5 +108,5 @@
108
108
  "ts-jest": "^26.4.1",
109
109
  "typesafe-actions": "^5.1.0"
110
110
  },
111
- "gitHead": "dead9ad5ace1c611522db9b0185da8121da2adf6"
111
+ "gitHead": "2a5238a1aa1421385d9a1473e5526f54efefe366"
112
112
  }
@@ -61,7 +61,7 @@
61
61
 
62
62
  @media (min-width: $screen-sm) {
63
63
  width: var(--bloom-width-2-3rd);
64
- margin-block-start: var(--bloom-s8);
65
- margin-inline-end: var(--bloom-s8);
64
+ padding-block-start: var(--bloom-s8);
65
+ padding-inline-end: var(--bloom-s8);
66
66
  }
67
67
  }
@@ -3,6 +3,7 @@
3
3
  --background-color: var(--bloom-color-primary-lighter);
4
4
  --border-color: var(--bloom-color-gray-450);
5
5
  --text-color: inherit;
6
+ --text-font-family: var(--bloom-font-serif);
6
7
  --inverse-background-color: var(--bloom-color-primary-darker);
7
8
  --inverse-border-color: var(--bloom-color-primary);
8
9
  --inverse-text-color: var(--bloom-color-white);
@@ -27,13 +28,25 @@
27
28
  }
28
29
 
29
30
  .page-header__group {
31
+ display: flex;
32
+ flex-direction: column;
33
+ align-items: center;
30
34
  padding: 0 var(--bloom-s5);
31
35
  margin: auto;
32
36
  max-width: var(--bloom-width-5xl);
37
+
38
+ @media (min-width: $screen-sm) {
39
+ align-items: flex-start;
40
+ }
41
+ }
42
+
43
+ .page-header__breadcrumbs {
44
+ margin-bottom: 10px;
33
45
  }
34
46
 
35
47
  .page-header__title {
36
48
  text-align: center;
49
+ font-family: var(--text-font-family);
37
50
 
38
51
  @media (min-width: $screen-md) {
39
52
  font-size: var(--title-font-size);
@@ -42,6 +55,6 @@
42
55
  }
43
56
 
44
57
  .page-header__lead {
45
- margin: auto;
58
+ font-family: var(--text-font-family);
46
59
  max-width: var(--bloom-width-5xl);
47
60
  }
@@ -8,6 +8,7 @@ export interface PageHeaderProps {
8
8
  subtitle?: string
9
9
  children?: React.ReactNode
10
10
  tabNav?: React.ReactNode
11
+ breadcrumbs?: React.ReactNode
11
12
  }
12
13
 
13
14
  const PageHeader = (props: PageHeaderProps) => {
@@ -18,8 +19,10 @@ const PageHeader = (props: PageHeaderProps) => {
18
19
  return (
19
20
  <header className={classNames.join(" ")}>
20
21
  <hgroup className="page-header__group">
22
+ {props?.breadcrumbs && <nav className="page-header__breadcrumbs">{props?.breadcrumbs}</nav>}
23
+
21
24
  {props.title && (
22
- <h1 data-test-id="page_header" className="page-header__title">
25
+ <h1 data-test-id="page-header" className="page-header__title">
23
26
  {props.title}
24
27
  </h1>
25
28
  )}
@@ -11,14 +11,17 @@
11
11
  .tab-nav__tab {
12
12
  a {
13
13
  @apply block;
14
- @apply px-6;
15
- @apply py-3;
14
+ @apply px-6 pb-3;
16
15
  @apply border-b-2;
17
16
  @apply text-gray-700;
18
17
  @apply items-center;
19
18
  border-color: transparent;
20
19
  line-height: 1.5rem;
21
20
 
21
+ @screen md {
22
+ @apply pb-3;
23
+ }
24
+
22
25
  &:hover {
23
26
  @apply text-gray-900;
24
27
  @apply border-gray-450;
@@ -0,0 +1,3 @@
1
+ .navigation-header {
2
+ --text-font-family: var(--bloom-font-alt-sans);
3
+ }
@@ -0,0 +1,95 @@
1
+ import React, { useMemo, useContext } from "react"
2
+ import { PageHeader, TabNav, TabNavItem, AppearanceSizeType } from "@bloom-housing/ui-components"
3
+ import { NavigationContext } from "../config/NavigationContext"
4
+ import "./NavigationHeader.scss"
5
+
6
+ type NavigationHeaderProps = {
7
+ className?: string
8
+ title: React.ReactNode
9
+ listingId?: string
10
+ tabs?: NavigationHeaderTabs
11
+ breadcrumbs?: React.ReactNode
12
+ children?: React.ReactChild
13
+ }
14
+
15
+ type NavigationHeaderTabs = {
16
+ show?: boolean
17
+ flagsQty?: number
18
+ listingLabel: string
19
+ applicationsLabel: string
20
+ flagsLabel: string
21
+ }
22
+
23
+ type NavigationHeaderTabsElement = {
24
+ label: string
25
+ path: string
26
+ content: React.ReactNode | undefined
27
+ }
28
+
29
+ const NavigationHeader = ({
30
+ className,
31
+ title,
32
+ listingId,
33
+ tabs,
34
+ children,
35
+ breadcrumbs,
36
+ }: NavigationHeaderProps) => {
37
+ const navigation = useContext(NavigationContext)
38
+ const currentPath = navigation.router.asPath
39
+
40
+ const tabNavElements = useMemo(() => {
41
+ const elements: NavigationHeaderTabsElement[] = [
42
+ {
43
+ label: tabs?.listingLabel || "",
44
+ path: `/listings/${listingId}`,
45
+ content: undefined,
46
+ },
47
+ {
48
+ label: tabs?.applicationsLabel || "",
49
+ path: `/listings/${listingId}/applications`,
50
+ content: undefined,
51
+ },
52
+ ]
53
+
54
+ if (process.env.showDuplicates && typeof tabs?.flagsQty === "number") {
55
+ elements.push({
56
+ label: tabs.flagsLabel,
57
+ path: `/listings/${listingId}/flags`,
58
+ content: <>{tabs.flagsQty}</>,
59
+ })
60
+ }
61
+
62
+ return elements
63
+ }, [tabs, listingId])
64
+
65
+ const tabNavItems = useMemo(() => {
66
+ return (
67
+ <TabNav className="relative -bottom-8 md:-bottom-10">
68
+ {tabNavElements.map((tab) => (
69
+ <TabNavItem
70
+ key={tab.path}
71
+ tagContent={tab?.content}
72
+ current={tab.path === currentPath}
73
+ href={tab.path}
74
+ tagSize={AppearanceSizeType.small}
75
+ >
76
+ {tab.label}
77
+ </TabNavItem>
78
+ ))}
79
+ </TabNav>
80
+ )
81
+ }, [currentPath, tabNavElements])
82
+
83
+ return (
84
+ <PageHeader
85
+ className={`navigation-header ${className ?? ""}`}
86
+ title={title}
87
+ tabNav={tabs?.show ? tabNavItems : null}
88
+ breadcrumbs={breadcrumbs}
89
+ >
90
+ {children}
91
+ </PageHeader>
92
+ )
93
+ }
94
+
95
+ export { NavigationHeader as default, NavigationHeader }
@@ -36,11 +36,16 @@ export interface ApplicationsProps {
36
36
  }
37
37
  /** Displays information regarding how to apply, including an online application link button, paper application downloads, and a paper application pickup address */
38
38
  const GetApplication = (props: ApplicationsProps) => {
39
+ const showSection =
40
+ props.onlineApplicationURL ||
41
+ (props.applicationsOpen && props.paperMethod && !!props.paperApplications?.length)
39
42
  const [showDownload, setShowDownload] = useState(false)
40
43
  const toggleDownload = () => setShowDownload(!showDownload)
41
44
 
45
+ if (!showSection) return null
46
+
42
47
  return (
43
- <section className="aside-block">
48
+ <section className="aside-block" data-test-id="get-application-section">
44
49
  <h2 className="text-caps-underline">{t("listings.apply.howToApply")}</h2>
45
50
  {!props.applicationsOpen && (
46
51
  <p className="mb-5 text-gray-700">
@@ -67,7 +72,8 @@ const GetApplication = (props: ApplicationsProps) => {
67
72
  )}
68
73
  </>
69
74
  )}
70
- {props.applicationsOpen && props.paperMethod && (
75
+
76
+ {props.applicationsOpen && props.paperMethod && !!props.paperApplications?.length && (
71
77
  <>
72
78
  {props.onlineApplicationURL && <OrDivider bgColor="white" />}
73
79
  <div className="text-serif-lg">{t("listings.apply.getAPaperApplication")}</div>