@codecademy/brand 5.0.0-alpha.bd910bfbb.0 → 5.1.0-alpha.0b3d95991.0

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.
@@ -7,11 +7,9 @@ export const DropdownList = ({
7
7
  menuButtonId,
8
8
  onClose
9
9
  }) => {
10
- const listRefsRef = React.useRef([]);
11
- const listRefs = listRefsRef.current;
12
- while (listRefs.length < dropdownItems.length) {
13
- listRefs.push(/*#__PURE__*/React.createRef());
14
- }
10
+ const listRefs = React.useMemo(() => Array.from({
11
+ length: dropdownItems.length
12
+ }, () => /*#__PURE__*/React.createRef()), [dropdownItems.length]);
15
13
  const handleKeyDown = (event, index) => {
16
14
  if (event.key === 'Tab') {
17
15
  event.preventDefault();
@@ -225,7 +225,7 @@ const profileMyProfile = {
225
225
  const profileAccount = {
226
226
  id: 'account',
227
227
  icon: GearIcon,
228
- href: '/account',
228
+ href: '/my_account',
229
229
  trackingTarget: 'avatar_settings',
230
230
  text: 'Account + Billing',
231
231
  type: 'link'
@@ -368,7 +368,7 @@ export const unpausePro = {
368
368
  dataTestId: 'unpause-link',
369
369
  id: 'unpause-pro',
370
370
  text: 'Unpause Now',
371
- href: '/account/billing',
371
+ href: '/my_account/billing',
372
372
  trackingTarget: 'topnav_pro_unpause',
373
373
  type: 'fill-button'
374
374
  };
@@ -1,10 +1,10 @@
1
- import { colors } from '@codecademy/gamut-styles';
1
+ import { theme } from '@codecademy/gamut-styles';
2
2
  import * as React from 'react';
3
3
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
4
  export const ProLabelCutout = ({
5
5
  ariaLabel = 'Pro',
6
- backgroundColor = colors.navy,
7
- cutoutColor = colors.white,
6
+ backgroundColor = theme.colors.navy,
7
+ cutoutColor = theme.colors.white,
8
8
  width = 30
9
9
  }) => /*#__PURE__*/_jsxs("svg", {
10
10
  width: width,
@@ -1,9 +1,9 @@
1
- import { colors } from '@codecademy/gamut-styles';
1
+ import { theme } from '@codecademy/gamut-styles';
2
2
  import * as React from 'react';
3
3
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
4
  export const ProLabelCutoutTransparent = ({
5
5
  ariaLabel = 'Pro',
6
- backgroundColor = colors.navy,
6
+ backgroundColor = theme.colors.navy,
7
7
  width = 30
8
8
  }) => /*#__PURE__*/_jsxs("svg", {
9
9
  width: width,
@@ -1,15 +1,15 @@
1
- import { colors } from '@codecademy/gamut-styles';
1
+ import { Colors } from '@codecademy/gamut-styles';
2
2
  import * as React from 'react';
3
3
  type BaseProps = {
4
4
  ariaLabel?: string;
5
- backgroundColor?: keyof typeof colors;
5
+ backgroundColor?: Colors;
6
6
  width?: number;
7
7
  };
8
8
  export type ProLabelProps = (BaseProps & {
9
9
  variant: 'transparent';
10
10
  }) | (BaseProps & {
11
11
  variant: 'cutout';
12
- cutoutColor?: keyof typeof colors;
12
+ cutoutColor?: Colors;
13
13
  });
14
14
  export declare const ProLabel: React.FC<ProLabelProps>;
15
15
  export {};
@@ -1,8 +1,9 @@
1
- import { colors } from '@codecademy/gamut-styles';
1
+ import { theme } from '@codecademy/gamut-styles';
2
2
  import * as React from 'react';
3
3
  import { ProLabelCutout } from './ProLabelCutout';
4
4
  import { ProLabelCutoutTransparent } from './ProLabelCutoutTransparent';
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
+ const themeColor = color => theme.colors[color];
6
7
  export const ProLabel = props => {
7
8
  if (props.variant === 'cutout') {
8
9
  const {
@@ -11,8 +12,8 @@ export const ProLabel = props => {
11
12
  ...forwardedProps
12
13
  } = props;
13
14
  return /*#__PURE__*/_jsx(ProLabelCutout, {
14
- backgroundColor: colors[backgroundColor],
15
- cutoutColor: colors[cutoutColor],
15
+ backgroundColor: themeColor(backgroundColor),
16
+ cutoutColor: themeColor(cutoutColor),
16
17
  ...forwardedProps
17
18
  });
18
19
  }
@@ -21,7 +22,7 @@ export const ProLabel = props => {
21
22
  ...forwardedProps
22
23
  } = props;
23
24
  return /*#__PURE__*/_jsx(ProLabelCutoutTransparent, {
24
- backgroundColor: colors[backgroundColor],
25
+ backgroundColor: themeColor(backgroundColor),
25
26
  ...forwardedProps
26
27
  });
27
28
  };
@@ -42,7 +42,7 @@ const getCTAUrl = ({
42
42
  case Product.Silver:
43
43
  case Product.Gold:
44
44
  if (userHasSilver) {
45
- return '/account/billing?changePlan=true';
45
+ return '/my_account/billing?changePlan=true';
46
46
  }
47
47
  return `/checkout?plan_id=${planId || undefined}`;
48
48
  case Product.Teams:
@@ -1,9 +1,9 @@
1
- import { colors } from '@codecademy/gamut-styles';
1
+ import { Colors } from '@codecademy/gamut-styles';
2
2
  import * as React from 'react';
3
3
  export type ProLogoAltProps = {
4
4
  ariaLabel?: string;
5
- backgroundColor?: keyof typeof colors;
6
- textColor?: keyof typeof colors;
5
+ backgroundColor?: Colors;
6
+ textColor?: Colors;
7
7
  width?: number;
8
8
  };
9
9
  export declare const ProLogoAlt: React.FC<ProLogoAltProps>;
@@ -1,6 +1,7 @@
1
- import { colors } from '@codecademy/gamut-styles';
1
+ import { theme } from '@codecademy/gamut-styles';
2
2
  import * as React from 'react';
3
3
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
+ const themeColor = color => theme.colors[color];
4
5
  export const ProLogoAlt = ({
5
6
  ariaLabel = 'Codecademy Pro Logo',
6
7
  backgroundColor = 'yellow',
@@ -13,14 +14,14 @@ export const ProLogoAlt = ({
13
14
  xmlns: "http://www.w3.org/2000/svg",
14
15
  "aria-label": ariaLabel,
15
16
  children: /*#__PURE__*/_jsxs("g", {
16
- fill: colors[backgroundColor],
17
+ fill: themeColor(backgroundColor),
17
18
  fillRule: "evenodd",
18
19
  children: [/*#__PURE__*/_jsx("path", {
19
20
  d: "m0 0h74v40h-74zm78 34h17v6h-17z",
20
- fill: colors[backgroundColor]
21
+ fill: themeColor(backgroundColor)
21
22
  }), /*#__PURE__*/_jsx("path", {
22
23
  d: "m13.971 23.67v6.82h-3.971v-20.145h6.82c4.749 0 7.253 2.965 7.253 6.62 0 3.625-2.504 6.705-7.253 6.705zm2.245-9.871h-2.245v6.446h2.245c2.187 0 3.77-1.036 3.77-3.28 0-2.245-1.583-3.166-3.77-3.166zm21.518 16.691-4.46-7.741h-2.821v7.741h-4v-20.145h7.568c4.404 0 6.994 2.62 6.994 6.13 0 1.9-.777 4.317-3.828 5.526l5.151 8.49h-4.604zm-.72-13.986c0-1.784-1.295-2.705-3.51-2.705h-3.051v5.468h3.05c2.216 0 3.511-1.036 3.511-2.763zm16.453-6.504c5.843 0 10.533 4.346 10.533 10.418s-4.69 10.417-10.533 10.417c-5.842 0-10.533-4.345-10.533-10.417s4.691-10.418 10.533-10.418zm0 17.152c3.799 0 6.36-2.878 6.36-6.734 0-3.857-2.561-6.734-6.36-6.734s-6.36 2.877-6.36 6.734c0 3.856 2.561 6.734 6.36 6.734z",
23
- fill: colors[textColor]
24
+ fill: themeColor(textColor)
24
25
  })]
25
26
  })
26
27
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codecademy/brand",
3
- "version": "5.0.0-alpha.bd910bfbb.0",
3
+ "version": "5.1.0-alpha.0b3d95991.0",
4
4
  "description": "Brand component library for Codecademy",
5
5
  "license": "MIT",
6
6
  "repository": "git@github.com:codecademy-engineering/mono.git",
@@ -22,7 +22,7 @@
22
22
  "freezeframe": "^5.0.2",
23
23
  "intersection-observer": "^0.12.0",
24
24
  "ismobilejs": "^1.1.1",
25
- "lodash": "^4.17.21",
25
+ "lodash": "^4.18.1",
26
26
  "pluralize": "^8.0.0",
27
27
  "react-freezeframe": "^5.0.2",
28
28
  "react-use": "15.3.8",