@bloom-housing/ui-components 4.4.1-alpha.13 → 4.4.1-alpha.16

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,41 @@
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.4.1-alpha.16](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@4.4.1-alpha.15...@bloom-housing/ui-components@4.4.1-alpha.16) (2022-06-07)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * changed aria-selected to aria-current issue [#698](https://github.com/bloom-housing/bloom/issues/698) ([bed1b23](https://github.com/bloom-housing/bloom/commit/bed1b23d63af134542f6760aa70d1ccac87940fa))
12
+
13
+
14
+ ### Features
15
+
16
+ * **sidenav component:** update Prototype SideNav Component for Production Usage ([4ae5e5c](https://github.com/bloom-housing/bloom/commit/4ae5e5c159c7150a808df85b2aa47e443256eb5f)), closes [#698](https://github.com/bloom-housing/bloom/issues/698)
17
+
18
+
19
+
20
+
21
+
22
+ ## [4.4.1-alpha.15](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@4.4.1-alpha.14...@bloom-housing/ui-components@4.4.1-alpha.15) (2022-06-07)
23
+
24
+ **Note:** Version bump only for package @bloom-housing/ui-components
25
+
26
+
27
+
28
+
29
+
30
+ ## [4.4.1-alpha.14](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@4.4.1-alpha.13...@bloom-housing/ui-components@4.4.1-alpha.14) (2022-06-06)
31
+
32
+
33
+ ### Features
34
+
35
+ * create table card component ([#2781](https://github.com/bloom-housing/bloom/issues/2781)) ([7cb3147](https://github.com/bloom-housing/bloom/commit/7cb31477268733b8b3d51dd77b2e33afb713ffbc))
36
+
37
+
38
+
39
+
40
+
6
41
  ## [4.4.1-alpha.13](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@4.4.1-alpha.12...@bloom-housing/ui-components@4.4.1-alpha.13) (2022-06-04)
7
42
 
8
43
 
package/index.ts CHANGED
@@ -16,6 +16,7 @@ export * from "./src/blocks/ImageCard"
16
16
  export * from "./src/blocks/InfoCard"
17
17
  export * from "./src/blocks/StatusBar"
18
18
  export * from "./src/blocks/ViewItem"
19
+ export * from "./src/blocks/StandardCard"
19
20
 
20
21
  /* Contexts */
21
22
  export * from "./src/authentication"
@@ -116,7 +117,7 @@ export * from "./src/page_components/listing/listing_sidebar/ReferralApplication
116
117
  export * from "./src/page_components/listing/listing_sidebar/ContactAddress"
117
118
  export * from "./src/page_components/listing/listing_sidebar/SubmitApplication"
118
119
  export * from "./src/page_components/listing/listing_sidebar/QuantityRowSection"
119
- export * from "./src/page_components/listing/listing_sidebar/WhatToExpect"
120
+ export * from "./src/page_components/listing/listing_sidebar/ExpandableSection"
120
121
  export * from "./src/page_components/listing/listing_sidebar/events/DownloadLotteryResults"
121
122
  export * from "./src/page_components/listing/listing_sidebar/events/EventSection"
122
123
  export * from "./src/page_components/sign-in/FormTerms"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bloom-housing/ui-components",
3
- "version": "4.4.1-alpha.13",
3
+ "version": "4.4.1-alpha.16",
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",
@@ -103,5 +103,5 @@
103
103
  "tailwindcss": "2.2.10",
104
104
  "typesafe-actions": "^5.1.0"
105
105
  },
106
- "gitHead": "c4fd2c06598100355cb253cad4e51a1f8bc3035d"
106
+ "gitHead": "24998ae0a2c0566bebd60573d117496967042f71"
107
107
  }
@@ -1,11 +1,14 @@
1
1
  import React, { useState } from "react"
2
- import { t } from "@bloom-housing/ui-components"
3
2
 
4
3
  type ExpandableContentProps = {
5
4
  children: React.ReactChild
5
+ strings: {
6
+ readMore?: string
7
+ readLess?: string
8
+ }
6
9
  }
7
10
 
8
- const ExpandableContent = ({ children }: ExpandableContentProps) => {
11
+ const ExpandableContent = ({ children, strings }: ExpandableContentProps) => {
9
12
  const [isExpanded, setExpanded] = useState(false)
10
13
 
11
14
  return (
@@ -18,7 +21,7 @@ const ExpandableContent = ({ children }: ExpandableContentProps) => {
18
21
  setExpanded(!isExpanded)
19
22
  }}
20
23
  >
21
- {t(isExpanded ? "t.readLess" : "t.readMore")}
24
+ {isExpanded ? strings.readLess : strings.readMore}
22
25
  </button>
23
26
 
24
27
  {isExpanded && <div className="mt-6">{children}</div>}
@@ -0,0 +1,34 @@
1
+ import { Canvas, Story, ArgsTable } from "@storybook/addon-docs"
2
+ import { StandardCard } from "./StandardCard"
3
+
4
+ # Standard Card
5
+
6
+ The standard card component displays a title with a child element (e.g table) and optional footer.
7
+
8
+ <Canvas>
9
+ <Story id="blocks-standard-card" />
10
+ </Canvas>
11
+
12
+
13
+ ## Component Properties
14
+
15
+ <ArgsTable of={StandardCard} />
16
+
17
+ ## Theming Variables
18
+
19
+ <Canvas>
20
+ <Story id="blocks-standard-card--style-overrides" />
21
+ </Canvas>
22
+
23
+ You can apply CSS variables to the `.standard-card` selector to customize the appearance of the component.
24
+
25
+ | Name | Type | Description | Default |
26
+ | ---------------------------- | ----- | --------------------------------------------------------- | ------------------------------- |
27
+ | `--font-family` | Font | Title font family | `--bloom-font-alt-sans` |
28
+ | `--border-radius` | Size | Card border radius | `--bloom-rounded-lg` |
29
+ | `--border-width` | Size | Card border width | `--bloom-border-1` |
30
+ | `--border-color` | Size | Card border color | `--bloom-color-gray-500` |
31
+ | `--title-color` | Color | Card title color | `--bloom-color-gray-900` |
32
+ | `--background-color` | Size | Card background color | `--bloom-color-white` |
33
+ | `--blank-color` | Color | Empty state text color | `--bloom-color-gray-750` |
34
+ | `--blank-background` | Color | Empty state background color | `--bloom-color-gray-200` |
@@ -0,0 +1,33 @@
1
+ .standard-card {
2
+ --font-family: var(--bloom-font-alt-sans);
3
+ --border-radius: var(--bloom-rounded-lg);
4
+ --border-width: var(--bloom-border-1);
5
+ --border-color: var(--bloom-color-gray-500);
6
+ --title-color: var(--bloom-color-gray-900);
7
+ --background-color: var(--bloom-color-white);
8
+ --blank-color: var(--bloom-color-gray-750);
9
+ --blank-background: var(--bloom-color-gray-200);
10
+ }
11
+
12
+ .standard-card__inner {
13
+ @apply overflow-hidden;
14
+ border-radius: var(--border-radius);
15
+ border: var(--border-width) solid var(--border-color);
16
+ background-color: var(--background-color);
17
+ }
18
+
19
+ .standard-card__title {
20
+ color: var(--title-color);
21
+ font-family: var(--font-family);
22
+ padding: var(--bloom-s6) var(--bloom-s6) var(--bloom-s2) var(--bloom-s7);
23
+ }
24
+
25
+ .standard-card__blank {
26
+ color: var(--blank-color);
27
+ background-color: var(--blank-background);
28
+ padding: var(--bloom-s3) var(--bloom-s7);
29
+ }
30
+
31
+ .standard-card__footer {
32
+ margin-top: var(--bloom-s3);
33
+ }
@@ -0,0 +1,37 @@
1
+ import React from "react"
2
+ import { Heading } from "../headers/Heading"
3
+ import "./StandardCard.scss"
4
+
5
+ export interface StandardCardProps {
6
+ className?: string
7
+ title?: string
8
+ children?: React.ReactNode
9
+ footer?: React.ReactNode
10
+ emptyStateMessage: string
11
+ }
12
+
13
+ const StandardCard = ({
14
+ className = "",
15
+ title,
16
+ children,
17
+ footer,
18
+ emptyStateMessage,
19
+ }: StandardCardProps) => {
20
+ return (
21
+ <div className={`standard-card ${className}`}>
22
+ <div className="standard-card__inner">
23
+ {title && (
24
+ <Heading className="standard-card__title" priority={3}>
25
+ {title}
26
+ </Heading>
27
+ )}
28
+
29
+ {children ? children : <div className="standard-card__blank">{emptyStateMessage}</div>}
30
+ </div>
31
+
32
+ {footer && <div className="standard-card__footer">{footer}</div>}
33
+ </div>
34
+ )
35
+ }
36
+
37
+ export { StandardCard as default, StandardCard }
@@ -103,7 +103,7 @@ const FieldGroup = ({
103
103
 
104
104
  {item.description && (
105
105
  <div className="ml-8 -mt-1 mb-5">
106
- <ExpandableContent>
106
+ <ExpandableContent strings={{ readMore: t("t.readMore"), readLess: t("t.readLess") }}>
107
107
  <p className="field-note mb-2 -mt-2">{item.description}</p>
108
108
  </ExpandableContent>
109
109
  </div>
@@ -3,13 +3,26 @@
3
3
  @apply rounded-lg;
4
4
 
5
5
  li {
6
- &:first-of-type a {
6
+ &:first-of-type {
7
7
  @apply rounded-t-lg;
8
8
  }
9
9
 
10
- &:last-of-type a {
10
+ &:last-of-type {
11
11
  @apply rounded-b-lg;
12
12
  }
13
+
14
+ &.is-current {
15
+ cursor: pointer;
16
+ @apply text-gray-900;
17
+ box-shadow: inset 3px 0px 0px 0px $tailwind-primary;
18
+ @apply block;
19
+ @apply px-4;
20
+ @apply py-2;
21
+ }
22
+
23
+ &:not(:last-child) {
24
+ @apply border-b;
25
+ }
13
26
  }
14
27
 
15
28
  a {
@@ -17,16 +30,9 @@
17
30
  @apply block;
18
31
  @apply px-4;
19
32
  @apply py-2;
20
- @apply border-b;
21
-
22
33
  &:hover {
23
34
  @apply bg-primary-lighter;
24
35
  @apply text-primary;
25
36
  }
26
-
27
- &.is-current {
28
- @apply text-gray-900;
29
- box-shadow: inset 3px 0px 0px 0px $tailwind-primary;
30
- }
31
37
  }
32
38
  }
@@ -0,0 +1,39 @@
1
+ import * as React from "react"
2
+ import { NavigationContext } from "../config/NavigationContext"
3
+ import "./SideNav.scss"
4
+
5
+ export interface SideNavItemProps {
6
+ current?: boolean
7
+ url: string
8
+ label: string
9
+ }
10
+
11
+ export interface SideNavProps {
12
+ navItems?: SideNavItemProps[]
13
+ }
14
+
15
+ const SideNav = (props: SideNavProps) => {
16
+ const { LinkComponent } = React.useContext(NavigationContext)
17
+
18
+ return (
19
+ <nav className="side-nav" aria-label="Secondary navigation">
20
+ <ul>
21
+ {props.navItems?.map((navItem: SideNavItemProps, index: number) => {
22
+ if (navItem.current) {
23
+ return (
24
+ <li className="is-current" key={index} aria-current="page">
25
+ {navItem.label}
26
+ </li>
27
+ )
28
+ }
29
+ return (
30
+ <li key={index}>
31
+ <LinkComponent href={navItem.url}>{navItem.label}</LinkComponent>
32
+ </li>
33
+ )
34
+ })}
35
+ </ul>
36
+ </nav>
37
+ )
38
+ }
39
+ export { SideNav as default, SideNav }
@@ -0,0 +1,34 @@
1
+ import * as React from "react"
2
+ import Markdown from "markdown-to-jsx"
3
+ import { ExpandableContent } from "../../../actions/ExpandableContent"
4
+
5
+ export interface ExpandableSectionProps {
6
+ content: string
7
+ expandableContent?: string
8
+ strings: {
9
+ title: string
10
+ readMore?: string
11
+ readLess?: string
12
+ }
13
+ }
14
+
15
+ const ExpandableSection = ({ content, expandableContent, strings }: ExpandableSectionProps) => {
16
+ if (!content) return null
17
+ return (
18
+ <section className="aside-block">
19
+ <h4 className="text-caps-underline">{strings.title}</h4>
20
+ <div className="text-tiny text-gray-750">
21
+ <Markdown options={{ disableParsingRawHTML: false }}>{content}</Markdown>
22
+ {expandableContent && (
23
+ <div className={"mt-2"}>
24
+ <ExpandableContent strings={{ readMore: strings.readMore, readLess: strings.readLess }}>
25
+ <Markdown options={{ disableParsingRawHTML: false }}>{expandableContent}</Markdown>
26
+ </ExpandableContent>
27
+ </div>
28
+ )}
29
+ </div>
30
+ </section>
31
+ )
32
+ }
33
+
34
+ export { ExpandableSection as default, ExpandableSection }
@@ -1,22 +0,0 @@
1
- import * as React from "react"
2
- import { t } from "../../../helpers/translator"
3
- import { Listing } from "@bloom-housing/backend-core/types"
4
-
5
- interface WhatToExpectProps {
6
- listing: Listing
7
- }
8
-
9
- const WhatToExpect = (props: WhatToExpectProps) => {
10
- const listing = props.listing
11
-
12
- return (
13
- <section className="aside-block">
14
- <h4 className="text-caps-underline">{t("whatToExpect.label")}</h4>
15
- <p className="text-tiny text-gray-800">
16
- {listing.whatToExpect ? listing.whatToExpect : t("whatToExpect.default")}
17
- </p>
18
- </section>
19
- )
20
- }
21
-
22
- export { WhatToExpect as default, WhatToExpect }
@@ -1,14 +0,0 @@
1
- import * as React from "react"
2
- import "./SideNav.scss"
3
-
4
- export interface SideNavProps {
5
- children: React.ReactNode[]
6
- }
7
-
8
- const SideNav = (props: SideNavProps) => (
9
- <nav className="side-nav" aria-label="Secondary navigation">
10
- <ul>{props.children}</ul>
11
- </nav>
12
- )
13
-
14
- export { SideNav as default, SideNav }