@guardian/interactive-component-library 0.4.1 → 0.4.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.
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
export function CircleIcon({ color, pulse, diameter, styles }: {
|
|
1
|
+
export function CircleIcon({ color, pulse, diameter, styles, splitColor, }: {
|
|
2
2
|
color: any;
|
|
3
3
|
pulse?: boolean;
|
|
4
4
|
diameter?: number;
|
|
5
5
|
styles: any;
|
|
6
|
+
splitColor: any;
|
|
6
7
|
}): import("preact").JSX.Element;
|
|
8
|
+
export type CircleIconProps = {
|
|
9
|
+
color: string;
|
|
10
|
+
pulse?: boolean;
|
|
11
|
+
diameter?: number;
|
|
12
|
+
splitColor?: string;
|
|
13
|
+
styles?: any;
|
|
14
|
+
};
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import { jsx } from "preact/jsx-runtime";
|
|
1
|
+
import { jsxs, jsx } from "preact/jsx-runtime";
|
|
2
2
|
import defaultStyles from "./style.module.css.js";
|
|
3
3
|
import { mergeStyles } from "../../../styles/helpers/mergeStyles.js";
|
|
4
|
-
const CircleIcon = ({
|
|
4
|
+
const CircleIcon = ({
|
|
5
|
+
color,
|
|
6
|
+
pulse = false,
|
|
7
|
+
diameter = 11,
|
|
8
|
+
styles,
|
|
9
|
+
splitColor
|
|
10
|
+
}) => {
|
|
5
11
|
styles = mergeStyles(defaultStyles, styles);
|
|
6
12
|
let radius = diameter / 2;
|
|
7
13
|
let padding = 2;
|
|
8
|
-
return /* @__PURE__ */
|
|
14
|
+
return /* @__PURE__ */ jsxs(
|
|
9
15
|
"svg",
|
|
10
16
|
{
|
|
11
17
|
style: styles.svg,
|
|
@@ -14,16 +20,26 @@ const CircleIcon = ({ color, pulse = false, diameter = 11, styles }) => {
|
|
|
14
20
|
viewBox: `0 0 ${diameter + padding} ${diameter + padding}`,
|
|
15
21
|
width: diameter + padding,
|
|
16
22
|
xmlns: "http://www.w3.org/2000/svg",
|
|
17
|
-
children:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ jsx(
|
|
25
|
+
"circle",
|
|
26
|
+
{
|
|
27
|
+
className: [styles.circle, pulse && styles.pulse].join(" "),
|
|
28
|
+
style: { fill: color },
|
|
29
|
+
r: radius,
|
|
30
|
+
cx: radius + padding / 2,
|
|
31
|
+
cy: radius + padding / 2
|
|
32
|
+
}
|
|
33
|
+
),
|
|
34
|
+
splitColor && /* @__PURE__ */ jsx(
|
|
35
|
+
"path",
|
|
36
|
+
{
|
|
37
|
+
d: `M ${radius + padding / 2} ${padding / 2} A ${radius} ${radius} 0 0 1 ${radius + padding / 2} ${diameter + padding / 2} L ${radius + padding / 2} ${radius + padding / 2} Z`,
|
|
38
|
+
fill: splitColor,
|
|
39
|
+
transform: `rotate(45 ${radius + padding / 2} ${radius + padding / 2})`
|
|
40
|
+
}
|
|
41
|
+
)
|
|
42
|
+
]
|
|
27
43
|
}
|
|
28
44
|
);
|
|
29
45
|
};
|