@bloom-housing/ui-components 5.1.1-alpha.3 → 5.1.1-alpha.4

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,21 @@
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.4](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@5.1.1-alpha.3...@bloom-housing/ui-components@5.1.1-alpha.4) (2022-08-12)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * clean up str variable assignment ([7db94e8](https://github.com/bloom-housing/bloom/commit/7db94e81d65eb7ff7314a435f7d34a93af22049e))
12
+ * fix changing const ([c5b37a9](https://github.com/bloom-housing/bloom/commit/c5b37a9106aab902f11e2a8034ea835c46c53d53))
13
+ * fix html string errors ([1548c60](https://github.com/bloom-housing/bloom/commit/1548c6085b882e8b894bc17d96a096553bf7eccf))
14
+ * remove types from removed dep ([4cd5e14](https://github.com/bloom-housing/bloom/commit/4cd5e148a29b6081f7337f26ed8e9e477e2737a4))
15
+ * replace usage of sanitize-html ([aad2f94](https://github.com/bloom-housing/bloom/commit/aad2f949ae6386d1e460b959808501be1b8c0f06))
16
+
17
+
18
+
19
+
20
+
6
21
  ## [5.1.1-alpha.3](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@5.1.1-alpha.2...@bloom-housing/ui-components@5.1.1-alpha.3) (2022-08-03)
7
22
 
8
23
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bloom-housing/ui-components",
3
- "version": "5.1.1-alpha.3",
3
+ "version": "5.1.1-alpha.4",
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",
@@ -85,7 +85,6 @@
85
85
  "@types/react-dom": "^16.9.5",
86
86
  "@types/react-text-mask": "^5.4.6",
87
87
  "@types/react-transition-group": "^4.4.0",
88
- "@types/sanitize-html": "^2.6.2",
89
88
  "ag-grid-community": "^26.0.0",
90
89
  "ag-grid-react": "^26.0.0",
91
90
  "aria-autocomplete": "^1.4.0",
@@ -107,10 +106,9 @@
107
106
  "react-tabs": "^3.2.2",
108
107
  "react-text-mask": "^5.4.3",
109
108
  "react-transition-group": "^4.4.1",
110
- "sanitize-html": "^2.7.1",
111
109
  "tailwindcss": "2.2.10",
112
110
  "ts-jest": "^26.4.1",
113
111
  "typesafe-actions": "^5.1.0"
114
112
  },
115
- "gitHead": "47d2dccffb21958f87769e4c46cfa3c977a5bf30"
113
+ "gitHead": "17b005dd65067cb9cf34d498834c448c20d3d2f6"
116
114
  }
@@ -1,5 +1,5 @@
1
1
  import * as React from "react"
2
- import sanitizeHtml from "sanitize-html"
2
+ import Markdown from "markdown-to-jsx"
3
3
 
4
4
  export interface Address {
5
5
  city?: string
@@ -19,20 +19,28 @@ export interface MultiLineAddressProps {
19
19
  const MultiLineAddress = ({ address }: MultiLineAddressProps) => {
20
20
  if (!address) return null
21
21
 
22
+ const makeHtmlString = (address: Address) => {
23
+ let str = ""
24
+
25
+ if (address.placeName) {
26
+ str += `${address.placeName} <br />`
27
+ }
28
+
29
+ if (address.street || address.street2) {
30
+ str += `${address.street || ""} ${address.street2 || ""} <br />`
31
+ }
32
+
33
+ if (address.city || address.state || address.zipCode) {
34
+ str += `${address.city && `${address.city} ,`} ${address.state} ${address.zipCode}`
35
+ }
36
+
37
+ return str
38
+ }
39
+
22
40
  return (
23
- <span
24
- dangerouslySetInnerHTML={{
25
- __html: sanitizeHtml(
26
- `
27
- ${address.placeName ? `${address.placeName} <br />` : ""}
28
- ${address.street || ""} ${address.street2 || ""}
29
- ${address.street || address.street2 ? `<br />` : ""}
30
- ${address.city}
31
- ${address.city && (address.state || address.zipCode) ? "," : ""} ${address.state} ${` `}
32
- ${address.zipCode}
33
- `
34
- ),
35
- }}
41
+ <Markdown
42
+ options={{ disableParsingRawHTML: false }}
43
+ children={`<span>${makeHtmlString(address)}</span>`}
36
44
  />
37
45
  )
38
46
  }