@thecb/components 8.3.1-beta.7 → 8.3.1-beta.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "8.3.1-beta.7",
3
+ "version": "8.3.1-beta.9",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -8,6 +8,7 @@ import { useMatch } from "react-router-dom";
8
8
 
9
9
  const ButtonWithLink = ({
10
10
  url = "/",
11
+ matchesCurrentRoute = false,
11
12
  disabled = false,
12
13
  fileLink = false,
13
14
  extraStyles,
@@ -19,13 +20,12 @@ const ButtonWithLink = ({
19
20
  const ButtonWithLinkWrapper = ({
20
21
  children,
21
22
  url,
23
+ matchesCurrentRoute,
22
24
  disabled,
23
25
  newTab,
24
26
  dataQa,
25
27
  extraStyles
26
28
  }) => {
27
- let match = useMatch(url);
28
- console.log("🚀 ~ file: ButtonWithLink.js:32 ~ match:", match)
29
29
  if (disabled) {
30
30
  return safeChildren(children, <span />);
31
31
  }
@@ -42,7 +42,7 @@ const ButtonWithLink = ({
42
42
  ) : (
43
43
  <InternalLink
44
44
  to={url}
45
- match={match}
45
+ matchesCurrentRoute={matchesCurrentRoute}
46
46
  tabIndex="-1"
47
47
  dataQa={dataQa}
48
48
  extraStyles={extraStyles}
@@ -54,6 +54,7 @@ const ButtonWithLink = ({
54
54
 
55
55
  return (
56
56
  <ButtonWithLinkWrapper
57
+ matchesCurrentRoute={matchesCurrentRoute}
57
58
  url={url}
58
59
  disabled={disabled}
59
60
  newTab={newTab}
@@ -24,7 +24,7 @@ export const StyledInternalLink = styled(
24
24
  font-size: ${({ fontSize }) => fontSize};
25
25
  font-family: ${({ fontFamily }) => fontFamily};
26
26
  margin: ${({ margin }) => margin};
27
- background-color: ${({ match }) => match ? INFO_BLUE : 'transparent'};
27
+ background-color: ${({ matchesCurrentRoute }) => matchesCurrentRoute ? INFO_BLUE : 'transparent'};
28
28
 
29
29
  &:hover {
30
30
  color: ${({ hoverColor }) => hoverColor};