@unitedstatespowersquadrons/components 1.0.13 → 1.1.0-pre.2

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.
@@ -10,6 +10,11 @@ const useStyles = createUseStyles({
10
10
  border: "none",
11
11
  padding: "0",
12
12
  },
13
+ link: {
14
+ display: "block",
15
+ margin: "0 auto",
16
+ width: "fit-content",
17
+ },
13
18
  });
14
19
 
15
20
  interface CoreBaseActionButtonProps {
@@ -99,24 +104,19 @@ const BaseActionButton = (props: BaseActionButtonProps) => {
99
104
  } else if ("href" in props) {
100
105
  const { href, newTab } = props;
101
106
 
102
- const onClick = () => {
103
- if (newTab) {
104
- open(href, "_blank");
105
- } else {
106
- location.href = href;
107
- }
108
- };
109
-
110
107
  return(
111
- <button
112
- className={classNames("action-button", classes.button, className)}
108
+ <a
109
+ className={classes.link}
110
+ href={href}
113
111
  id={id}
114
- onClick={onClick}
112
+ rel={newTab ? "noreferrer" : undefined}
113
+ target={newTab ? "_blank" : undefined}
115
114
  title={title}
116
- type="button"
117
115
  >
118
- {children}
119
- </button>
116
+ <button className={classNames("action-button", classes.button, className)} type="button">
117
+ {children}
118
+ </button>
119
+ </a>
120
120
  );
121
121
  } else {
122
122
  throw new Error("Invalid BaseActionButton configuration: must specify props: onClick | (href & method?)");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unitedstatespowersquadrons/components",
3
- "version": "1.0.13",
3
+ "version": "1.1.0-pre.2",
4
4
  "description": "USPS shared React components library",
5
5
  "main": "index.tsx",
6
6
  "scripts": {