@bloom-housing/ui-components 5.1.1-alpha.7 → 5.1.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,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.1.1-alpha.8](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@5.1.1-alpha.7...@bloom-housing/ui-components@5.1.1-alpha.8) (2022-08-18)
7
+
8
+
9
+ ### Features
10
+
11
+ * **expandabletext:** add classname to expandable text button ([#2965](https://github.com/bloom-housing/bloom/issues/2965)) ([6d4b8a7](https://github.com/bloom-housing/bloom/commit/6d4b8a7132825c1aa3abcc0368529557cb3d2647))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [5.1.1-alpha.7](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@5.1.1-alpha.6...@bloom-housing/ui-components@5.1.1-alpha.7) (2022-08-18)
7
18
 
8
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bloom-housing/ui-components",
3
- "version": "5.1.1-alpha.7",
3
+ "version": "5.1.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",
@@ -110,5 +110,5 @@
110
110
  "ts-jest": "^26.4.1",
111
111
  "typesafe-actions": "^5.1.0"
112
112
  },
113
- "gitHead": "fd80654f0c4e2b3449734cb6ac7927a078304f47"
113
+ "gitHead": "4d9b251b65009ccfb30a4e16693453ad4267f914"
114
114
  }
@@ -12,6 +12,7 @@ export interface ExpandableTextProps {
12
12
  readLess: string
13
13
  }
14
14
  markdownProps?: MarkdownOptions
15
+ buttonClassName?: string
15
16
  }
16
17
 
17
18
  const getText = (text: string, expanded: boolean, maxLength: number) => {
@@ -29,10 +30,16 @@ const getText = (text: string, expanded: boolean, maxLength: number) => {
29
30
  const moreLessButton = (
30
31
  expanded: boolean,
31
32
  setExpanded: (newValue: boolean) => void,
32
- strings: ExpandableTextProps["strings"]
33
+ strings: ExpandableTextProps["strings"],
34
+ buttonClassName: ExpandableTextProps["buttonClassName"]
33
35
  ) => {
36
+ const classes = ["button-toggle ml-4"]
37
+ if (buttonClassName) {
38
+ classes.push(buttonClassName)
39
+ }
40
+
34
41
  return (
35
- <span className="button-toggle" onClick={() => setExpanded(!expanded)}>
42
+ <span className={classes.join(" ")} onClick={() => setExpanded(!expanded)}>
36
43
  {expanded ? strings?.readLess : strings?.readMore}
37
44
  </span>
38
45
  )
@@ -46,7 +53,7 @@ const ExpandableText = (props: ExpandableTextProps) => {
46
53
  if (!props.children) return null
47
54
 
48
55
  if (props.children.length > maxLength) {
49
- button = moreLessButton(expanded, setExpanded, props.strings)
56
+ button = moreLessButton(expanded, setExpanded, props.strings, props.buttonClassName)
50
57
  }
51
58
  return (
52
59
  <div className={`expandable-text ${props?.className}`}>