@thecb/components 7.1.3-beta.1 → 7.1.3-beta.3
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/dist/index.cjs.js +8 -8
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -4
- package/dist/index.esm.js +8 -8
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/link/ExternalLink.d.ts +1 -2
- package/src/components/atoms/link/ExternalLink.js +48 -46
- package/src/components/atoms/link/ExternalLink.styled.js +3 -3
- package/src/components/atoms/link/InternalLink.d.ts +1 -2
- package/src/components/atoms/link/InternalLink.js +48 -46
- package/src/components/atoms/link/InternalLink.styled.js +6 -3
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useContext } from "react";
|
|
1
|
+
import React, { useContext, forwardRef } from "react";
|
|
2
2
|
import { ThemeContext } from "styled-components";
|
|
3
3
|
import { fallbackValues } from "./Link.theme";
|
|
4
4
|
import { createThemeValues } from "../../../util/themeUtils";
|
|
@@ -6,51 +6,53 @@ import { StyledExternalLink } from "./ExternalLink.styled";
|
|
|
6
6
|
import { FONT_WEIGHT_REGULAR } from "../../../constants/style_constants";
|
|
7
7
|
import { safeChildren } from "../../../util/general";
|
|
8
8
|
|
|
9
|
-
const ExternalLink = (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
9
|
+
const ExternalLink = forwardRef(
|
|
10
|
+
(
|
|
11
|
+
{
|
|
12
|
+
href = "",
|
|
13
|
+
newTab = false,
|
|
14
|
+
size = "1rem",
|
|
15
|
+
lineHeight = "1.5rem",
|
|
16
|
+
weight = FONT_WEIGHT_REGULAR,
|
|
17
|
+
extraStyles = ``,
|
|
18
|
+
variant = "primary",
|
|
19
|
+
tabIndex = "0",
|
|
20
|
+
dataQa,
|
|
21
|
+
ariaLabel,
|
|
22
|
+
children
|
|
23
|
+
},
|
|
24
|
+
ref
|
|
25
|
+
) => {
|
|
26
|
+
const themeContext = useContext(ThemeContext);
|
|
27
|
+
const themeValues = createThemeValues(
|
|
28
|
+
themeContext,
|
|
29
|
+
fallbackValues,
|
|
30
|
+
"Link",
|
|
31
|
+
variant
|
|
32
|
+
);
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
34
|
+
return (
|
|
35
|
+
<StyledExternalLink
|
|
36
|
+
href={href}
|
|
37
|
+
target={newTab ? "_blank" : ""}
|
|
38
|
+
color={themeValues.externalLinkColor}
|
|
39
|
+
size={size}
|
|
40
|
+
lineheight={lineHeight}
|
|
41
|
+
weight={weight}
|
|
42
|
+
hovercolor={themeValues.hoverColor}
|
|
43
|
+
activeColor={themeValues.activeColor}
|
|
44
|
+
fontFamily={themeValues.fontFamily}
|
|
45
|
+
tabIndex={tabIndex}
|
|
46
|
+
extrastyles={extraStyles}
|
|
47
|
+
rel={newTab ? "noopener" : ""}
|
|
48
|
+
data-qa={dataQa}
|
|
49
|
+
aria-label={ariaLabel}
|
|
50
|
+
ref={ref}
|
|
51
|
+
>
|
|
52
|
+
{safeChildren(children, <span />)}
|
|
53
|
+
</StyledExternalLink>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
);
|
|
55
57
|
|
|
56
58
|
export default ExternalLink;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
2
|
import styled from "styled-components";
|
|
3
3
|
import { ROYAL_BLUE } from "../../../constants/colors";
|
|
4
4
|
/*
|
|
@@ -8,9 +8,9 @@ import { ROYAL_BLUE } from "../../../constants/colors";
|
|
|
8
8
|
|
|
9
9
|
/* eslint-disable no-unused-vars */
|
|
10
10
|
export const StyledExternalLink = styled(
|
|
11
|
-
({ hoverColor, activeColor, extrastyles, ...props }, ref) => (
|
|
11
|
+
forwardRef(({ hoverColor, activeColor, extrastyles, ...props }, ref) => (
|
|
12
12
|
<a {...props} ref={ref} />
|
|
13
|
-
)
|
|
13
|
+
))
|
|
14
14
|
)`
|
|
15
15
|
display: flex;
|
|
16
16
|
font-size: ${({ size }) => size};
|
|
@@ -1,55 +1,57 @@
|
|
|
1
|
-
import React, { useContext } from "react";
|
|
1
|
+
import React, { useContext, forwardRef } from "react";
|
|
2
2
|
import { ThemeContext } from "styled-components";
|
|
3
3
|
import { fallbackValues } from "./Link.theme";
|
|
4
4
|
import { createThemeValues } from "../../../util/themeUtils";
|
|
5
5
|
import { StyledInternalLink } from "./InternalLink.styled";
|
|
6
6
|
import { safeChildren } from "../../../util/general";
|
|
7
7
|
|
|
8
|
-
const InternalLink = (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
8
|
+
const InternalLink = forwardRef(
|
|
9
|
+
(
|
|
10
|
+
{
|
|
11
|
+
to = "",
|
|
12
|
+
color,
|
|
13
|
+
children,
|
|
14
|
+
active,
|
|
15
|
+
fontSize,
|
|
16
|
+
lineheight,
|
|
17
|
+
fontWeight,
|
|
18
|
+
variant = "primary",
|
|
19
|
+
margin,
|
|
20
|
+
tabIndex = "0",
|
|
21
|
+
dataQa,
|
|
22
|
+
extraStyles = ``
|
|
23
|
+
},
|
|
24
|
+
ref
|
|
25
|
+
) => {
|
|
26
|
+
const themeContext = useContext(ThemeContext);
|
|
27
|
+
const themeValues = createThemeValues(
|
|
28
|
+
themeContext,
|
|
29
|
+
fallbackValues,
|
|
30
|
+
"Link",
|
|
31
|
+
variant
|
|
32
|
+
);
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
34
|
+
return (
|
|
35
|
+
<StyledInternalLink
|
|
36
|
+
to={to}
|
|
37
|
+
color={color}
|
|
38
|
+
lineheight={lineheight}
|
|
39
|
+
active={active}
|
|
40
|
+
fontWeight={fontWeight}
|
|
41
|
+
fontSize={fontSize}
|
|
42
|
+
fontFamily={themeValues.fontFamily}
|
|
43
|
+
margin={margin}
|
|
44
|
+
hoverColor={themeValues.hoverColor}
|
|
45
|
+
activeColor={themeValues.activeColor}
|
|
46
|
+
tabIndex={tabIndex}
|
|
47
|
+
extrastyles={extraStyles}
|
|
48
|
+
data-qa={dataQa}
|
|
49
|
+
ref={ref}
|
|
50
|
+
>
|
|
51
|
+
{safeChildren(children, <span />)}
|
|
52
|
+
</StyledInternalLink>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
);
|
|
54
56
|
|
|
55
57
|
export default InternalLink;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
2
|
import styled from "styled-components";
|
|
3
3
|
import { Link } from "react-router-dom";
|
|
4
4
|
import { ROYAL_BLUE } from "../../../constants/colors";
|
|
@@ -9,8 +9,11 @@ import { ROYAL_BLUE } from "../../../constants/colors";
|
|
|
9
9
|
|
|
10
10
|
/* eslint-disable no-unused-vars */
|
|
11
11
|
export const StyledInternalLink = styled(
|
|
12
|
-
(
|
|
13
|
-
|
|
12
|
+
forwardRef(
|
|
13
|
+
(
|
|
14
|
+
{ hoverColor, activeColor, active, color, extrastyles, ...props },
|
|
15
|
+
ref
|
|
16
|
+
) => <Link {...props} ref={ref} />
|
|
14
17
|
)
|
|
15
18
|
)`
|
|
16
19
|
display: flex;
|