@unitedstatespowersquadrons/components 1.4.2-1 → 1.4.2-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.
- package/IconButton.tsx +20 -9
- package/package.json +1 -1
package/IconButton.tsx
CHANGED
|
@@ -1,24 +1,35 @@
|
|
|
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
|
+
import Colors, { ButtonColorName } from "./Colors";
|
|
5
5
|
import FontAwesomeIcon, { FontAwesomeProps } from "./FontAwesomeIcon";
|
|
6
6
|
import BaseActionButton from "./BaseActionButton";
|
|
7
7
|
import { HrefProps, MethodProps, OnClickProps } from "./types";
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
// FA duotone uses `--fa-primary-color` / `--fa-secondary-color`. Their
|
|
10
|
+
// out-of-the-box defaults are `inherit` (currentColor), but the kit can
|
|
11
|
+
// override that with literal hexes, which freezes the duotone color
|
|
12
|
+
// regardless of `color`. Re-pin both to `currentColor` so each layer
|
|
13
|
+
// follows our `color` while `--fa-secondary-opacity` (default 0.4) keeps
|
|
14
|
+
// the duotone contrast.
|
|
15
|
+
const colorize = (hex: string) => ({
|
|
16
|
+
"--fa-primary-color": "currentColor",
|
|
17
|
+
"--fa-secondary-color": "currentColor",
|
|
18
|
+
color: hex,
|
|
19
|
+
});
|
|
9
20
|
|
|
10
21
|
const useStyles = createUseStyles({
|
|
11
|
-
blue:
|
|
12
|
-
darkGray:
|
|
13
|
-
gray:
|
|
14
|
-
green:
|
|
22
|
+
blue: colorize(Colors.blue),
|
|
23
|
+
darkGray: colorize(Colors.darkGray),
|
|
24
|
+
gray: colorize(Colors.gray),
|
|
25
|
+
green: colorize(Colors.green),
|
|
15
26
|
icon: {
|
|
16
27
|
cursor: "pointer",
|
|
17
28
|
fontSize: "1.1em",
|
|
18
29
|
},
|
|
19
|
-
orange:
|
|
20
|
-
purple:
|
|
21
|
-
red:
|
|
30
|
+
orange: colorize(Colors.orange),
|
|
31
|
+
purple: colorize(Colors.purple),
|
|
32
|
+
red: colorize(Colors.red),
|
|
22
33
|
wrapperLink: {
|
|
23
34
|
display: "inline-block",
|
|
24
35
|
margin: "0",
|