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

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.5",
3
+ "version": "8.3.1-beta.7",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -4,11 +4,10 @@ import { URL_TEST } from "../../../constants/regex_constants";
4
4
  import { InternalLink, ExternalLink } from "../link";
5
5
  import { safeChildren } from "../../../util/general";
6
6
  import ButtonWithAction from "../button-with-action";
7
+ import { useMatch } from "react-router-dom";
7
8
 
8
9
  const ButtonWithLink = ({
9
10
  url = "/",
10
- active = false,
11
- activeBackgroundColor = undefined,
12
11
  disabled = false,
13
12
  fileLink = false,
14
13
  extraStyles,
@@ -20,13 +19,13 @@ const ButtonWithLink = ({
20
19
  const ButtonWithLinkWrapper = ({
21
20
  children,
22
21
  url,
23
- active,
24
- activeBackgroundColor,
25
22
  disabled,
26
23
  newTab,
27
24
  dataQa,
28
25
  extraStyles
29
26
  }) => {
27
+ let match = useMatch(url);
28
+ console.log("🚀 ~ file: ButtonWithLink.js:32 ~ match:", match)
30
29
  if (disabled) {
31
30
  return safeChildren(children, <span />);
32
31
  }
@@ -43,8 +42,7 @@ const ButtonWithLink = ({
43
42
  ) : (
44
43
  <InternalLink
45
44
  to={url}
46
- active={active}
47
- activeBackgroundColor={activeBackgroundColor}
45
+ match={match}
48
46
  tabIndex="-1"
49
47
  dataQa={dataQa}
50
48
  extraStyles={extraStyles}
@@ -57,8 +55,6 @@ const ButtonWithLink = ({
57
55
  return (
58
56
  <ButtonWithLinkWrapper
59
57
  url={url}
60
- active={active}
61
- activeBackgroundColor={activeBackgroundColor}
62
58
  disabled={disabled}
63
59
  newTab={newTab}
64
60
  extraStyles={`${linkExtraStyles} text-decoration: none; &:hover {
@@ -1,6 +1,6 @@
1
1
  import React, { forwardRef } from "react";
2
2
  import styled from "styled-components";
3
- import { Link, useMatch } from "react-router-dom";
3
+ import { Link } from "react-router-dom";
4
4
  import { ROYAL_BLUE, INFO_BLUE} from "../../../constants/colors";
5
5
  /*
6
6
  The extracting of props and the disabling of the eslint rule is to stop React from complaining about
@@ -13,11 +13,7 @@ export const StyledInternalLink = styled(
13
13
  (
14
14
  { hoverColor, activeColor, active, color, extrastyles, ...props },
15
15
  ref
16
- ) => {
17
- let match = useMatch();
18
- console.log("🚀 ~ file: InternalLink.styled.js:18 ~ match:", match);
19
- return <Link {...props} match={match} ref={ref} />
20
- }
16
+ ) => <Link {...props} ref={ref} />
21
17
  )
22
18
  )`
23
19
  display: flex;
@@ -43,7 +39,6 @@ export const StyledInternalLink = styled(
43
39
  &:active {
44
40
  text-decoration: underline;
45
41
  color: ${({ activeColor }) => activeColor};
46
- background-color: ${({ activeBackgroundColor }) => activeBackgroundColor ? activeBackgroundColor : 'transparent'};
47
42
  }
48
43
 
49
44
  ${({ extrastyles }) => extrastyles}
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  SAPPHIRE_BLUE,
3
3
  PEACOCK_BLUE,
4
- INFO_BLUE,
5
4
  MATISSE_BLUE,
6
5
  } from "../../../constants/colors";
7
6
 
@@ -12,13 +11,11 @@ const fontFamily = {
12
11
 
13
12
  const hoverColor = SAPPHIRE_BLUE;
14
13
  const activeColor = PEACOCK_BLUE;
15
- const activeBackgroundColor = INFO_BLUE;
16
14
  const externalLinkColor = MATISSE_BLUE;
17
15
 
18
16
  export const fallbackValues = {
19
17
  fontFamily,
20
18
  hoverColor,
21
19
  activeColor,
22
- activeBackgroundColor,
23
20
  externalLinkColor,
24
21
  };