@unitedstatespowersquadrons/components 1.4.1 → 1.4.2-1
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/IconButton.tsx +13 -5
- package/package.json +1 -1
package/IconButton.tsx
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { createUseStyles } from "react-jss";
|
|
3
3
|
import classNames from "classnames";
|
|
4
|
+
import { ButtonColorName } from "./Colors";
|
|
4
5
|
import FontAwesomeIcon, { FontAwesomeProps } from "./FontAwesomeIcon";
|
|
5
6
|
import BaseActionButton from "./BaseActionButton";
|
|
6
7
|
import { HrefProps, MethodProps, OnClickProps } from "./types";
|
|
7
8
|
import Styles from "./Styles";
|
|
8
9
|
|
|
9
10
|
const useStyles = createUseStyles({
|
|
11
|
+
blue: { ...Styles.blue },
|
|
12
|
+
darkGray: { ...Styles.darkGray },
|
|
13
|
+
gray: { ...Styles.gray },
|
|
14
|
+
green: { ...Styles.green },
|
|
10
15
|
icon: {
|
|
11
|
-
...Styles.blue,
|
|
12
16
|
cursor: "pointer",
|
|
13
17
|
fontSize: "1.1em",
|
|
14
18
|
},
|
|
19
|
+
orange: { ...Styles.orange },
|
|
20
|
+
purple: { ...Styles.purple },
|
|
21
|
+
red: { ...Styles.red },
|
|
15
22
|
wrapperLink: {
|
|
16
23
|
display: "inline-block",
|
|
17
24
|
margin: "0",
|
|
@@ -21,6 +28,7 @@ const useStyles = createUseStyles({
|
|
|
21
28
|
|
|
22
29
|
interface CoreIconProps extends FontAwesomeProps {
|
|
23
30
|
className?: string;
|
|
31
|
+
color?: ButtonColorName;
|
|
24
32
|
id?: string | undefined;
|
|
25
33
|
title: string;
|
|
26
34
|
}
|
|
@@ -35,12 +43,12 @@ export type IconButtonProps =
|
|
|
35
43
|
| IconButtonOnClickProps;
|
|
36
44
|
|
|
37
45
|
const IconButton = (props: IconButtonProps) => {
|
|
38
|
-
const { className, fa, icon, id, mode, style, title } = props;
|
|
46
|
+
const { className, color, fa, icon, id, mode, style, title } = props;
|
|
39
47
|
const classes = useStyles();
|
|
40
48
|
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
const combinedClassName =
|
|
49
|
+
const colorClassName = classes[color ?? "blue"];
|
|
50
|
+
const combinedClassName = classNames(classes.icon, colorClassName, className);
|
|
51
|
+
const configuredIcon = <FontAwesomeIcon css={combinedClassName} fa={fa} icon={icon} mode={mode} style={style} />;
|
|
44
52
|
|
|
45
53
|
if ("onClick" in props) {
|
|
46
54
|
const { confirm, onClick } = props;
|