@codecademy/brand 1.2.0-alpha.d2262b5c02.0 → 1.2.0-alpha.df77222e22.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.
@@ -6,8 +6,8 @@ interface AppHeaderNavButtonBaseProps {
6
6
  title?: string;
7
7
  }
8
8
  interface AppHeaderTextNavButtonProps extends AppHeaderNavButtonBaseProps {
9
- icon?: undefined;
10
- isIconOnly?: undefined;
9
+ icon?: never;
10
+ isIconOnly?: never;
11
11
  }
12
12
  interface AppHeaderIconNavButtonProps extends AppHeaderNavButtonBaseProps {
13
13
  icon: React.ComponentType<GamutIconProps>;
@@ -17,10 +17,21 @@ export const AppHeaderNavButton = _ref => {
17
17
  item: item
18
18
  });
19
19
  }
20
+ if ('isIconOnly' in item && item?.icon) {
21
+ return /*#__PURE__*/_jsx(AppHeaderDropdownNavButton, {
22
+ buttonRef: buttonRef,
23
+ handleOnClick: handleOnClick,
24
+ isOpen: isOpen,
25
+ title: item.text,
26
+ icon: item.icon,
27
+ isIconOnly: item.isIconOnly
28
+ });
29
+ }
20
30
  return /*#__PURE__*/_jsx(AppHeaderDropdownNavButton, {
21
31
  buttonRef: buttonRef,
22
32
  handleOnClick: handleOnClick,
23
33
  isOpen: isOpen,
24
- title: item.text
34
+ title: item.text,
35
+ icon: item?.icon
25
36
  });
26
37
  };
@@ -9,10 +9,6 @@ type AppHeaderBaseItem<Type extends string> = {
9
9
  redirect?: boolean;
10
10
  type: Type;
11
11
  };
12
- type AppHeaderIconButtonItem = AppHeaderBaseItem<'dropdown'> & {
13
- icon?: React.ComponentType<GamutIconProps>;
14
- isIconOnly?: boolean;
15
- };
16
12
  type AppHeaderBaseHrefItem<Type extends string> = AppHeaderBaseItem<Type> & {
17
13
  href: string;
18
14
  trackingTarget?: string;
@@ -38,10 +34,12 @@ export type AppHeaderFillButtonItem = AppHeaderBaseHrefItem<'fill-button'> & Pic
38
34
  text: string;
39
35
  };
40
36
  export type AppHeaderDropdownItem = AppHeaderSimpleDropdownItem | AppHeaderProfileDropdownItem | AppHeaderResourcesSimpleDropdownItem;
41
- export type AppHeaderSimpleDropdownItem = AppHeaderBaseItem<'dropdown'> & AppHeaderIconButtonItem & {
37
+ export type AppHeaderSimpleDropdownItem = AppHeaderBaseItem<'dropdown'> & {
42
38
  popover: AppHeaderLinkItem[];
43
39
  text: string;
44
- trackingTarget?: string;
40
+ trackingTarget: string;
41
+ icon?: React.ComponentType<GamutIconProps>;
42
+ isIconOnly?: boolean;
45
43
  };
46
44
  export type AppHeaderProfileDropdownItem = AppHeaderBaseItem<'profile-dropdown'> & {
47
45
  avatar: string;
@@ -60,10 +58,10 @@ export type AppHeaderCatalogDropdownItem = AppHeaderBaseItem<'catalog-dropdown'>
60
58
  hideCareerPaths?: boolean;
61
59
  };
62
60
  export type AppHeaderResourcesDropdownItem = AppHeaderBaseItem<'resources-dropdown'> & {
63
- icon?: React.ComponentType<GamutIconProps>;
64
61
  text: string;
65
62
  trackingTarget?: string;
66
63
  hideCareerPaths?: boolean;
64
+ icon?: React.ComponentType<GamutIconProps>;
67
65
  };
68
66
  export type AppHeaderResourcesSimpleDropdownItem = AppHeaderBaseItem<'resources-simple-dropdown'> & {
69
67
  icon?: React.ComponentType<GamutIconProps>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@codecademy/brand",
3
3
  "description": "Brand component library for Codecademy",
4
- "version": "1.2.0-alpha.d2262b5c02.0",
4
+ "version": "1.2.0-alpha.df77222e22.0",
5
5
  "author": "Codecademy Engineering <dev@codecademy.com>",
6
6
  "dependencies": {
7
7
  "@emotion/is-prop-valid": "^1.2.1",