@unitedstatespowersquadrons/components 1.4.11 → 1.4.12

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.
@@ -1,27 +1,31 @@
1
1
  import React from "react";
2
2
  import Badge from "./Badge";
3
3
  import { ReachableStatus } from "./types";
4
+ import { badgeify } from "./helpers";
4
5
 
5
6
  interface Props {
6
7
  host: string;
7
8
  reachable?: ReachableStatus;
9
+ url?: string;
8
10
  }
9
11
 
10
12
  const ReachableBadge = (props: Props) => {
11
- const { host, reachable } = props;
13
+ const { host, reachable, url } = props;
12
14
 
13
15
  const status = reachable?.status;
14
16
  const reason = reachable?.reason || "Error";
15
17
 
18
+ const name = badgeify(host)!;
19
+
16
20
  const badge = () => {
17
21
  if (status) {
18
- return <Badge color="brightgreen" content="Reachable" label={host} />;
22
+ return <Badge color="brightgreen" content="Reachable" label={name} />;
19
23
  } else {
20
- return <Badge color="red" content={reason} label={host} />;
24
+ return <Badge color="red" content={reason} label={name} />;
21
25
  }
22
26
  };
23
27
 
24
- return <a href={`https://${host}.aws.usps.org`} rel="noreferrer" target="_blank">{badge()}</a>;
28
+ return <a href={url || `https://${host}.aws.usps.org`} rel="noreferrer" target="_blank">{badge()}</a>;
25
29
  };
26
30
 
27
31
  export default ReachableBadge;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unitedstatespowersquadrons/components",
3
- "version": "1.4.11",
3
+ "version": "1.4.12",
4
4
  "description": "USPS shared React components library",
5
5
  "main": "index.tsx",
6
6
  "scripts": {