@unitedstatespowersquadrons/components 1.2.18-2 → 1.2.18-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.
Files changed (2) hide show
  1. package/ActionButton.tsx +27 -10
  2. package/package.json +1 -1
package/ActionButton.tsx CHANGED
@@ -33,6 +33,11 @@ const useStyles = createUseStyles({
33
33
  margin: "0 auto",
34
34
  width: "fit-content",
35
35
  },
36
+ wrapperLinkInline: {
37
+ display: "inline-block",
38
+ margin: "0 auto",
39
+ width: "fit-content",
40
+ },
36
41
  });
37
42
 
38
43
  export interface CoreActionButtonProps extends FontAwesomeProps {
@@ -40,6 +45,8 @@ export interface CoreActionButtonProps extends FontAwesomeProps {
40
45
  color: ButtonColorName;
41
46
  grayMode?: boolean | undefined;
42
47
  id?: string;
48
+ inline?: boolean;
49
+ rightIcon?: boolean;
43
50
  size?: "big" | "mediumWithMargin" | "medium" | "small" | undefined;
44
51
  subtext?: string;
45
52
  text: string;
@@ -63,7 +70,7 @@ export type ActionButtonProps =
63
70
  | ActionButtonFormProps;
64
71
 
65
72
  const ActionButton = (props: ActionButtonProps) => {
66
- const { className, color, fa, grayMode, icon, id, mode, size, style, subtext, text, title } = props;
73
+ const { className, color, fa, grayMode, icon, id, mode, rightIcon, size, style, subtext, text, title } = props;
67
74
  const classes = useStyles();
68
75
 
69
76
  const colorClassName = classes[`${color}${grayMode ? "Gray" : "Colored"}`];
@@ -79,13 +86,23 @@ const ActionButton = (props: ActionButtonProps) => {
79
86
  };
80
87
 
81
88
  const buttonContents = () => {
82
- return(
83
- <>
84
- <FontAwesomeIcon fa={fa} icon={icon} mode={mode} style={style} />
85
- <span>{text}</span>
86
- {subtext && <small className={classes.subText}>({subtext})</small>}
87
- </>
88
- );
89
+ if (rightIcon) {
90
+ return(
91
+ <>
92
+ <span>{text}</span>
93
+ {subtext && <small className={classes.subText}>({subtext})</small>}
94
+ <FontAwesomeIcon fa={fa} icon={icon} mode={mode} style={style} />
95
+ </>
96
+ );
97
+ } else {
98
+ return(
99
+ <>
100
+ <FontAwesomeIcon fa={fa} icon={icon} mode={mode} style={style} />
101
+ <span>{text}</span>
102
+ {subtext && <small className={classes.subText}>({subtext})</small>}
103
+ </>
104
+ );
105
+ }
89
106
  };
90
107
 
91
108
  if ("onClick" in props) {
@@ -118,14 +135,14 @@ const ActionButton = (props: ActionButtonProps) => {
118
135
  </BaseActionButton>
119
136
  );
120
137
  } else if ("href" in props) {
121
- const { href, linkClassName } = props;
138
+ const { href, inline, linkClassName } = props;
122
139
 
123
140
  return(
124
141
  <BaseActionButton
125
142
  className={classNames(classes.button, colorClassName, sizeClassName(), className)}
126
143
  href={href}
127
144
  id={id}
128
- linkClassName={classNames(classes.wrapperLink, linkClassName)}
145
+ linkClassName={classNames(inline ? classes.wrapperLinkInline : classes.wrapperLink, linkClassName)}
129
146
  title={title}
130
147
  >
131
148
  {buttonContents()}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unitedstatespowersquadrons/components",
3
- "version": "1.2.18-2",
3
+ "version": "1.2.18-4",
4
4
  "description": "USPS shared React components library",
5
5
  "main": "index.tsx",
6
6
  "scripts": {