@nuskin/foundation-ui-components 1.8.1-738-v2.2 → 1.8.1

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": "@nuskin/foundation-ui-components",
3
- "version": "1.8.1-738-v2.2",
3
+ "version": "1.8.1",
4
4
  "description": "It is a foundation library written in react, that provides common components to all UI pages",
5
5
  "main": "src/common/index.ts",
6
6
  "repository": {
@@ -1,9 +1,9 @@
1
- import { NsTypography } from '../';
1
+ import { NavTabs, NsLink, NsTypography } from '../';
2
2
  import { NavTabBox, NavTabUnderLine, NavTitlesBox } from './NsNavTab.styled';
3
3
  import { Show } from '../utility';
4
4
 
5
5
  type NavTitlesProps = {
6
- tabs: any[];
6
+ tabs: NavTabs[];
7
7
  // eslint-disable-next-line no-unused-vars
8
8
  setActive(_x: string): void;
9
9
  active: string | null;
@@ -11,6 +11,17 @@ type NavTitlesProps = {
11
11
  };
12
12
 
13
13
  export const NavTitles = ({ tabs, setActive, active, tabTitleClassName }: NavTitlesProps) => {
14
+ const NavTitleTypography = (tab: NavTabs) => (
15
+ <NsTypography
16
+ variant={tab.textVariant}
17
+ additionalProps={{ ...tab?.liveTag }}
18
+ className={`${tabTitleClassName} ${!active ? 'opacity-8' : ''}`}
19
+ color={tab.tabName === active ? tab.activeColor : tab.color}
20
+ >
21
+ {tab.tabName}
22
+ </NsTypography>
23
+ );
24
+
14
25
  return (
15
26
  <NavTitlesBox className="desktop-nav-titles">
16
27
  {tabs?.map((tab) => {
@@ -32,14 +43,13 @@ export const NavTitles = ({ tabs, setActive, active, tabTitleClassName }: NavTit
32
43
  }}
33
44
  animate
34
45
  >
35
- <NsTypography
36
- variant={tab.textVariant}
37
- additionalProps={{ ...tab?.liveTag }}
38
- className={`${tabTitleClassName} ${!active ? 'opacity-8' : ''}`}
39
- color={tab.tabName === active ? tab.activeColor : tab.color}
40
- >
41
- {tab.tabName}
42
- </NsTypography>
46
+ {tab?.tabLink ? (
47
+ <NsLink href={tab.tabLink} underlineOnHover={false}>
48
+ <NavTitleTypography {...tab} />
49
+ </NsLink>
50
+ ) : (
51
+ <NavTitleTypography {...tab} />
52
+ )}
43
53
  </NavTabBox>
44
54
  <Show when={active === tab.tabName}>
45
55
  <NavTabUnderLine data-testid="underline" layoutId="underline" color={tab.activeColor} />
@@ -5,6 +5,7 @@ import { AdditionalProps, CslpTag } from '../common.types';
5
5
 
6
6
  export type NavTabs = {
7
7
  tabName: string;
8
+ tabLink?: string;
8
9
  tabContent?: ReactNode;
9
10
  activeColor: FoundationTheme.PaletteColors;
10
11
  color?: FoundationTheme.PaletteColors;