@bloom-housing/ui-components 5.0.1-alpha.10 → 5.0.1-alpha.11

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,17 @@
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.11](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@5.0.1-alpha.10...@bloom-housing/ui-components@5.0.1-alpha.11) (2022-07-11)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * ux updates and bug fixes for sidebar components ([#2859](https://github.com/bloom-housing/bloom/issues/2859)) ([1bd3b36](https://github.com/bloom-housing/bloom/commit/1bd3b36415ff55be88ea5ada6184de2c232f2da5))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [5.0.1-alpha.10](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@5.0.1-alpha.9...@bloom-housing/ui-components@5.0.1-alpha.10) (2022-07-08)
7
18
 
8
19
  **Note:** Version bump only for package @bloom-housing/ui-components
package/index.ts CHANGED
@@ -116,6 +116,7 @@ export * from "./src/page_components/listing/listing_sidebar/NumberedHeader"
116
116
  export * from "./src/page_components/listing/listing_sidebar/OrDivider"
117
117
  export * from "./src/page_components/listing/listing_sidebar/ReferralApplication"
118
118
  export * from "./src/page_components/listing/listing_sidebar/ContactAddress"
119
+ export * from "./src/page_components/listing/listing_sidebar/SidebarBlock"
119
120
  export * from "./src/page_components/listing/listing_sidebar/SubmitApplication"
120
121
  export * from "./src/page_components/listing/listing_sidebar/QuantityRowSection"
121
122
  export * from "./src/page_components/listing/listing_sidebar/ExpandableSection"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bloom-housing/ui-components",
3
- "version": "5.0.1-alpha.10",
3
+ "version": "5.0.1-alpha.11",
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": "1af8ace49178551e8c6cbeea3dfdc6fc1240e3c9"
111
+ "gitHead": "7641496db149c31bf7307ed44367ae1b3688e2b7"
112
112
  }
@@ -29,6 +29,10 @@
29
29
  font-weight: var(--label-weight);
30
30
  line-height: var(--bloom-line-height-snug);
31
31
 
32
+ &.transition {
33
+ transition: all 200ms ease-out;
34
+ }
35
+
32
36
  &:focus {
33
37
  outline: none;
34
38
  box-shadow: 0 0 0 2px #fff, 0 0 3px 4px var(--bloom-color-accent-cool);
@@ -36,6 +40,9 @@
36
40
 
37
41
  &:hover {
38
42
  border-color: var(--bloom-color-primary-dark);
43
+ &.transition {
44
+ transition: all 200ms ease-in;
45
+ }
39
46
  }
40
47
 
41
48
  &:disabled {
@@ -4,25 +4,26 @@ import { AppearanceProps, classNamesForAppearanceTypes } from "../global/Appeara
4
4
  import { Icon, IconSize, UniversalIconType } from "../icons/Icon"
5
5
 
6
6
  export interface ButtonProps extends AppearanceProps {
7
- id?: string
8
- type?: "button" | "submit" | "reset"
7
+ "data-test-id"?: string
8
+ ariaHidden?: boolean
9
+ ariaLabel?: string
9
10
  children: React.ReactNode
10
- onClick?: (e: React.MouseEvent) => void
11
+ className?: string
12
+ dataTestId?: string
13
+ disabled?: boolean
14
+ fullWidth?: boolean
11
15
  icon?: UniversalIconType
12
16
  iconPlacement?: "left" | "right"
13
17
  iconSize?: IconSize
18
+ id?: string
14
19
  // TODO: inlineIcon is deprecated
15
- inlineIcon?: "left" | "right"
16
20
  inline?: boolean
17
- unstyled?: boolean
18
- fullWidth?: boolean
19
- className?: string
20
- disabled?: boolean
21
+ inlineIcon?: "left" | "right"
21
22
  loading?: boolean
22
- ariaHidden?: boolean
23
- ariaLabel?: string
24
- dataTestId?: string
25
- "data-test-id"?: string
23
+ onClick?: (e: React.MouseEvent) => void
24
+ transition?: boolean
25
+ type?: "button" | "submit" | "reset"
26
+ unstyled?: boolean
26
27
  }
27
28
 
28
29
  export const buttonClassesForProps = (props: Omit<ButtonProps, "onClick">) => {
@@ -36,6 +37,7 @@ export const buttonClassesForProps = (props: Omit<ButtonProps, "onClick">) => {
36
37
  if (props.fullWidth) classNames.push("is-fullwidth")
37
38
  if (props.className) classNames.push(props.className)
38
39
  if (props.loading) classNames.push("is-loading")
40
+ if (props.transition) classNames.push("transition")
39
41
  return classNames
40
42
  }
41
43
 
@@ -15,6 +15,7 @@ const ExpandableContent = ({ children, strings, className }: ExpandableContentPr
15
15
 
16
16
  return (
17
17
  <div className={rootClassNames}>
18
+ {isExpanded && <div>{children}</div>}
18
19
  <button
19
20
  type="button"
20
21
  className="button is-unstyled m-0 no-underline has-toggle"
@@ -25,7 +26,6 @@ const ExpandableContent = ({ children, strings, className }: ExpandableContentPr
25
26
  >
26
27
  {isExpanded ? strings.readLess : strings.readMore}
27
28
  </button>
28
- {isExpanded && <div className="mt-6">{children}</div>}
29
29
  </div>
30
30
  )
31
31
  }
@@ -3,10 +3,14 @@ import "./Button.scss"
3
3
  import { buttonClassesForProps, buttonInner, ButtonProps } from "./Button"
4
4
  import { NavigationContext } from "../config/NavigationContext"
5
5
  import { isExternalLink } from "../helpers/links"
6
+ import { faUpRightFromSquare } from "@fortawesome/free-solid-svg-icons"
7
+ import { Icon } from "../icons/Icon"
6
8
 
7
9
  export interface LinkButtonProps extends Omit<ButtonProps, "onClick"> {
8
10
  href: string
9
11
  dataTestId?: string
12
+ newTab?: boolean
13
+ newTabIcon?: boolean
10
14
  }
11
15
 
12
16
  const LinkButton = (props: LinkButtonProps) => {
@@ -15,8 +19,19 @@ const LinkButton = (props: LinkButtonProps) => {
15
19
 
16
20
  if (isExternalLink(props.href)) {
17
21
  return (
18
- <a href={props.href} className={buttonClasses.join(" ")} data-test-id={props.dataTestId}>
22
+ <a
23
+ href={props.href}
24
+ className={buttonClasses.join(" ")}
25
+ data-test-id={props.dataTestId}
26
+ target={props.newTab ? "_blank" : "_self"}
27
+ >
19
28
  {buttonInner(props)}
29
+ {props.newTabIcon && (
30
+ <>
31
+ <Icon symbol={faUpRightFromSquare} size={"small"} className={"ml-2"} />
32
+ <span className="sr-only">{"Opens in a new tab"}</span>
33
+ </>
34
+ )}
20
35
  </a>
21
36
  )
22
37
  } else {
@@ -3,7 +3,7 @@ import Markdown from "markdown-to-jsx"
3
3
  import { ExpandableContent } from "../../../actions/ExpandableContent"
4
4
 
5
5
  export interface ExpandableSectionProps {
6
- content: string
6
+ content: string | React.ReactNode
7
7
  expandableContent?: string
8
8
  strings: {
9
9
  title: string
@@ -18,7 +18,11 @@ const ExpandableSection = ({ content, expandableContent, strings }: ExpandableSe
18
18
  <section className="aside-block">
19
19
  <h4 className="text-caps-underline">{strings.title}</h4>
20
20
  <div className="text-tiny text-gray-750">
21
- <Markdown options={{ disableParsingRawHTML: false }}>{content}</Markdown>
21
+ {typeof content === "string" ? (
22
+ <Markdown options={{ disableParsingRawHTML: false }}>{content}</Markdown>
23
+ ) : (
24
+ content
25
+ )}
22
26
  {expandableContent && (
23
27
  <div className={"mt-2"}>
24
28
  <ExpandableContent strings={{ readMore: strings.readMore, readLess: strings.readLess }}>
@@ -0,0 +1,23 @@
1
+ import * as React from "react"
2
+ import { Heading, HeaderType, HeadingProps } from "../../../headers/Heading"
3
+
4
+ export interface SidebarBlockProps extends Omit<HeadingProps, "children" | "className"> {
5
+ children: React.ReactNode
6
+ className?: string
7
+ title?: string
8
+ }
9
+
10
+ const SidebarBlock = ({ children, className, title, priority, style }: SidebarBlockProps) => {
11
+ return (
12
+ <section className={`aside-block ${className ? className : ""}`}>
13
+ {title && (
14
+ <Heading priority={priority ?? 4} style={style ?? "sidebarHeader"}>
15
+ {title}
16
+ </Heading>
17
+ )}
18
+ <div className="text-tiny text-gray-750">{children}</div>
19
+ </section>
20
+ )
21
+ }
22
+
23
+ export { SidebarBlock as default, SidebarBlock }