@nuskin/foundation-ui-components 1.16.0-cx130-990.1 → 1.16.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.
- package/package.json +2 -3
- package/src/common/dropdown/NsDropdown.spec.tsx +32 -31
- package/src/common/dropdown/NsDropdown.styled.tsx +13 -22
- package/src/common/dropdown/NsDropdown.tsx +37 -19
- package/src/common/dropdown/NsDropdownOption.tsx +5 -17
- package/src/common/dropdown/stories/NsDropdown.stories.tsx +5 -7
- package/src/common/dropdown/stories/NsDropdownCountry.stories.tsx +4 -7
- package/src/common/dropdown/types.d.ts +6 -8
- package/src/common/nav-tab/NavTitles.tsx +4 -3
- package/src/common/text-strip/NsTextStrip.tsx +1 -1
- package/src/common/typography/Typography.styled.tsx +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuskin/foundation-ui-components",
|
|
3
|
-
"version": "1.16.0
|
|
3
|
+
"version": "1.16.0",
|
|
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": {
|
|
@@ -102,6 +102,5 @@
|
|
|
102
102
|
"files": [
|
|
103
103
|
"src/common"
|
|
104
104
|
],
|
|
105
|
-
"readme": "./README.md"
|
|
106
|
-
"packageManager": "yarn@3.6.3"
|
|
105
|
+
"readme": "./README.md"
|
|
107
106
|
}
|
|
@@ -4,12 +4,15 @@ import NsDropdown from './NsDropdown';
|
|
|
4
4
|
import NsDropdownOption from './NsDropdownOption';
|
|
5
5
|
|
|
6
6
|
function createDropdownOptions(options: { value: string; label: string }[]) {
|
|
7
|
-
return options.map((option) =>
|
|
7
|
+
return options.map((option) => (
|
|
8
|
+
<NsDropdownOption key={option.value} value={option.value}>
|
|
9
|
+
{option.label}
|
|
10
|
+
</NsDropdownOption>
|
|
11
|
+
));
|
|
8
12
|
}
|
|
9
13
|
|
|
10
14
|
describe('NsDropdown', () => {
|
|
11
15
|
const onSelect = jest.fn();
|
|
12
|
-
const selectedValue = '';
|
|
13
16
|
const selectedLabel = '';
|
|
14
17
|
|
|
15
18
|
const options = [
|
|
@@ -18,14 +21,9 @@ describe('NsDropdown', () => {
|
|
|
18
21
|
{ value: 'Option 3', label: 'Option 3' },
|
|
19
22
|
];
|
|
20
23
|
|
|
21
|
-
it('
|
|
24
|
+
it('1. Should render the placeholder text when no value is selected', () => {
|
|
22
25
|
render(
|
|
23
|
-
<NsDropdown
|
|
24
|
-
placeholder="Select an option"
|
|
25
|
-
selectedValue={selectedValue}
|
|
26
|
-
selectedLabel={selectedLabel}
|
|
27
|
-
onSelect={onSelect}
|
|
28
|
-
>
|
|
26
|
+
<NsDropdown placeholder="Select an option" selectedLabel={selectedLabel} onSelect={onSelect}>
|
|
29
27
|
{createDropdownOptions(options)}
|
|
30
28
|
</NsDropdown>
|
|
31
29
|
);
|
|
@@ -33,20 +31,23 @@ describe('NsDropdown', () => {
|
|
|
33
31
|
expect(screen.getByText('Select an option')).toBeInTheDocument();
|
|
34
32
|
});
|
|
35
33
|
|
|
36
|
-
it('
|
|
37
|
-
const selectedLabel = 'Option 1';
|
|
34
|
+
it('2. Should render the selected value label', () => {
|
|
38
35
|
render(
|
|
39
|
-
<NsDropdown
|
|
36
|
+
<NsDropdown selectedLabel={selectedLabel} onSelect={onSelect}>
|
|
40
37
|
{createDropdownOptions(options)}
|
|
41
38
|
</NsDropdown>
|
|
42
39
|
);
|
|
40
|
+
const dropdownHead = screen.getByTestId('dropdown-head');
|
|
41
|
+
fireEvent.click(dropdownHead);
|
|
42
|
+
const dropdownOptionContainer = screen.getByTestId('dropdown-option-container-0');
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
fireEvent.click(dropdownOptionContainer);
|
|
45
|
+
expect(onSelect).toHaveBeenCalledWith('Option 1');
|
|
45
46
|
});
|
|
46
47
|
|
|
47
|
-
it('
|
|
48
|
+
it('3. Should open and close Dropdown on click', () => {
|
|
48
49
|
render(
|
|
49
|
-
<NsDropdown
|
|
50
|
+
<NsDropdown selectedLabel={selectedLabel} onSelect={onSelect}>
|
|
50
51
|
{createDropdownOptions(options)}
|
|
51
52
|
</NsDropdown>
|
|
52
53
|
);
|
|
@@ -64,14 +65,9 @@ describe('NsDropdown', () => {
|
|
|
64
65
|
expect(screen.queryByTestId('option-Option 3')).not.toBeInTheDocument();
|
|
65
66
|
});
|
|
66
67
|
|
|
67
|
-
it('dropdown
|
|
68
|
+
it('4. Should close dropdown on mouse leave when closeOnMouseLeave is set to true', async () => {
|
|
68
69
|
render(
|
|
69
|
-
<NsDropdown
|
|
70
|
-
closeOnMouseLeave
|
|
71
|
-
selectedValue={selectedValue}
|
|
72
|
-
selectedLabel={selectedLabel}
|
|
73
|
-
onSelect={onSelect}
|
|
74
|
-
>
|
|
70
|
+
<NsDropdown closeOnMouseLeave selectedLabel={selectedLabel} onSelect={onSelect}>
|
|
75
71
|
{createDropdownOptions(options)}
|
|
76
72
|
</NsDropdown>
|
|
77
73
|
);
|
|
@@ -88,14 +84,9 @@ describe('NsDropdown', () => {
|
|
|
88
84
|
expect(screen.queryByTestId('option-Option 3')).not.toBeInTheDocument();
|
|
89
85
|
});
|
|
90
86
|
});
|
|
91
|
-
it('
|
|
87
|
+
it('5. Should not close dropdown on mouse leave when closeOnMouseLeave is set to false', () => {
|
|
92
88
|
render(
|
|
93
|
-
<NsDropdown
|
|
94
|
-
selectedValue={selectedValue}
|
|
95
|
-
selectedLabel={selectedLabel}
|
|
96
|
-
onSelect={onSelect}
|
|
97
|
-
closeOnMouseLeave={false}
|
|
98
|
-
>
|
|
89
|
+
<NsDropdown selectedLabel={selectedLabel} onSelect={onSelect} closeOnMouseLeave={false}>
|
|
99
90
|
{createDropdownOptions(options)}
|
|
100
91
|
</NsDropdown>
|
|
101
92
|
);
|
|
@@ -110,9 +101,9 @@ describe('NsDropdown', () => {
|
|
|
110
101
|
expect(screen.getByTestId('option-Option 2')).toBeInTheDocument();
|
|
111
102
|
expect(screen.getByTestId('option-Option 3')).toBeInTheDocument();
|
|
112
103
|
});
|
|
113
|
-
it('
|
|
104
|
+
it('6. Should not open dropdown when disabled is set to true', () => {
|
|
114
105
|
render(
|
|
115
|
-
<NsDropdown
|
|
106
|
+
<NsDropdown selectedLabel={selectedLabel} onSelect={onSelect} disabled>
|
|
116
107
|
{createDropdownOptions(options)}
|
|
117
108
|
</NsDropdown>
|
|
118
109
|
);
|
|
@@ -122,4 +113,14 @@ describe('NsDropdown', () => {
|
|
|
122
113
|
|
|
123
114
|
expect(screen.queryByTestId('dropdown-list')).not.toBeInTheDocument();
|
|
124
115
|
});
|
|
116
|
+
it('7. Should apply no border style when type is not outlined', () => {
|
|
117
|
+
render(
|
|
118
|
+
<NsDropdown selectedLabel={selectedLabel} onSelect={onSelect} type="unfilled">
|
|
119
|
+
{createDropdownOptions(options)}
|
|
120
|
+
</NsDropdown>
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
const dropdownHead = screen.getByTestId('dropdown-head');
|
|
124
|
+
expect(dropdownHead).toHaveStyle('border: none');
|
|
125
|
+
});
|
|
125
126
|
});
|
|
@@ -6,6 +6,7 @@ export const DropdownContainer = styled.div<{ disabled: boolean }>`
|
|
|
6
6
|
position: relative;
|
|
7
7
|
display: inline-block;
|
|
8
8
|
opacity: ${({ disabled }) => (disabled ? '0.5' : '1')};
|
|
9
|
+
cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'pointer')};
|
|
9
10
|
`;
|
|
10
11
|
|
|
11
12
|
/** this function also used for SelectHead */
|
|
@@ -22,7 +23,7 @@ export const DropdownHead = styled.div<{ type: string; disabled: boolean }>`
|
|
|
22
23
|
display: flex;
|
|
23
24
|
justify-content: space-between;
|
|
24
25
|
align-items: center;
|
|
25
|
-
border: ${getDropdownHeadBorder}
|
|
26
|
+
border: ${getDropdownHeadBorder};
|
|
26
27
|
color: ${paletteColor('primary')};
|
|
27
28
|
`;
|
|
28
29
|
|
|
@@ -37,39 +38,29 @@ export const DropdownList = styled.div<{ borderColor: FoundationTheme.PaletteCol
|
|
|
37
38
|
position: absolute;
|
|
38
39
|
z-index: 100;
|
|
39
40
|
border: 1px solid ${({ borderColor, theme }) => paletteColor(borderColor)({ theme })};
|
|
40
|
-
|
|
41
|
-
margin: 0;
|
|
41
|
+
margin-top: 10px;
|
|
42
42
|
width: 100%;
|
|
43
43
|
color: ${paletteColor('primary', 'main')};
|
|
44
44
|
background-color: ${paletteColor('primary', 'contrastText')};
|
|
45
45
|
`;
|
|
46
46
|
|
|
47
|
-
const getDividerColor = (theme: FoundationTheme.Theme) => {
|
|
48
|
-
return color('neutral', isDarkMode({ theme }) ? '20' : '30')({ theme });
|
|
49
|
-
};
|
|
50
47
|
const getListBgColor = (theme: FoundationTheme.Theme) => {
|
|
51
48
|
return color('accentColorB', isDarkMode({ theme }) ? '50' : '10')({ theme });
|
|
52
49
|
};
|
|
53
|
-
export const ListItemContainer = styled.div<{ showListDivider: boolean }>`
|
|
54
|
-
cursor: pointer;
|
|
55
|
-
padding: 5px 0;
|
|
56
|
-
border-bottom: 1px solid ${({ showListDivider, theme }) => (showListDivider ? getDividerColor(theme) : 'none')};
|
|
57
|
-
|
|
58
|
-
&:hover {
|
|
59
|
-
background-color: ${({ theme }) => getListBgColor(theme)};
|
|
60
|
-
}
|
|
61
50
|
|
|
51
|
+
export const DropdownOptionContainer = styled.div`
|
|
52
|
+
cursor: pointer;
|
|
62
53
|
&:last-child {
|
|
63
54
|
border-bottom: none;
|
|
64
55
|
}
|
|
65
56
|
`;
|
|
66
57
|
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
58
|
+
export const ListItem = styled.div`
|
|
59
|
+
&:hover {
|
|
60
|
+
background-color: ${({ theme }) => getListBgColor(theme)};
|
|
61
|
+
}
|
|
62
|
+
&:active {
|
|
63
|
+
background-color: #7de3e8;
|
|
64
|
+
}
|
|
65
|
+
padding: 10px;
|
|
75
66
|
`;
|
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
import React, { useCallback, useRef, useState } from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
DropdownContainer,
|
|
5
|
+
DropdownButton,
|
|
6
|
+
DropdownList,
|
|
7
|
+
DropdownHead,
|
|
8
|
+
DropdownOptionContainer,
|
|
9
|
+
} from './NsDropdown.styled';
|
|
4
10
|
import { NsIcon } from '../icon';
|
|
5
11
|
import { DropdownProps } from './types.d';
|
|
6
12
|
import { useOnClickOutside } from '../hooks/useOnClickOutside';
|
|
7
13
|
|
|
8
14
|
const NsDropdown: React.FC<DropdownProps> = ({
|
|
9
|
-
selectedValue,
|
|
10
15
|
selectedLabel,
|
|
11
16
|
onSelect,
|
|
12
17
|
children,
|
|
13
18
|
disabled = false,
|
|
14
19
|
type = 'outlined',
|
|
15
|
-
placeholder = 'Select',
|
|
16
20
|
dropdownBorderColor = 'accentColorB',
|
|
17
21
|
closeOnMouseLeave = false,
|
|
18
|
-
|
|
22
|
+
className,
|
|
23
|
+
placeholder,
|
|
19
24
|
}) => {
|
|
20
25
|
const [isOpen, setIsOpen] = useState(false);
|
|
21
|
-
const [value, setValue] = useState(selectedValue || '');
|
|
22
26
|
const dropdownRef = useRef<HTMLDivElement | null>(null);
|
|
23
27
|
|
|
24
28
|
const handleToggle = useCallback(() => {
|
|
@@ -41,31 +45,45 @@ const NsDropdown: React.FC<DropdownProps> = ({
|
|
|
41
45
|
const handleSelect = (input: string) => {
|
|
42
46
|
onSelect(input);
|
|
43
47
|
setIsOpen(false);
|
|
44
|
-
setValue(input);
|
|
45
48
|
};
|
|
46
49
|
|
|
47
50
|
return (
|
|
48
|
-
<DropdownContainer disabled={disabled} ref={dropdownRef}>
|
|
49
|
-
<DropdownHead
|
|
51
|
+
<DropdownContainer disabled={disabled} ref={dropdownRef} className={className}>
|
|
52
|
+
<DropdownHead
|
|
53
|
+
data-testid="dropdown-head"
|
|
54
|
+
id="dropdown-head"
|
|
55
|
+
disabled={disabled}
|
|
56
|
+
type={type}
|
|
57
|
+
onClick={handleToggle}
|
|
58
|
+
>
|
|
50
59
|
<DropdownButton>{selectedLabel || placeholder}</DropdownButton>
|
|
51
|
-
<NsIcon
|
|
60
|
+
<NsIcon
|
|
61
|
+
testId="chevron-icon"
|
|
62
|
+
id="chevron-icon"
|
|
63
|
+
name="arrowDown"
|
|
64
|
+
color="primary"
|
|
65
|
+
cursor={disabled ? 'not-allowed' : 'pointer'}
|
|
66
|
+
/>
|
|
52
67
|
</DropdownHead>
|
|
53
68
|
{isOpen ? (
|
|
54
69
|
<DropdownList
|
|
55
70
|
data-testid="dropdown-list"
|
|
71
|
+
id="dropdown-list"
|
|
56
72
|
onMouseLeave={handleOnMouseLeave}
|
|
57
73
|
borderColor={dropdownBorderColor}
|
|
58
74
|
>
|
|
59
|
-
{
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
75
|
+
{children.map((child, key) => {
|
|
76
|
+
const value = React.isValidElement(child) ? child.props.value : child;
|
|
77
|
+
return (
|
|
78
|
+
<DropdownOptionContainer
|
|
79
|
+
data-testid={`dropdown-option-container-${key}`}
|
|
80
|
+
className="dropdown-option-container"
|
|
81
|
+
key={key}
|
|
82
|
+
onClick={() => handleSelect(value)}
|
|
83
|
+
>
|
|
84
|
+
{child}
|
|
85
|
+
</DropdownOptionContainer>
|
|
86
|
+
);
|
|
69
87
|
})}
|
|
70
88
|
</DropdownList>
|
|
71
89
|
) : null}
|
|
@@ -1,24 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ListItem, ListItemContainer } from './NsDropdown.styled';
|
|
3
2
|
import { DropdownOptionProps } from './types.d';
|
|
3
|
+
import { ListItem } from './NsDropdown.styled';
|
|
4
4
|
|
|
5
|
-
export const NsDropdownOption: React.FC<DropdownOptionProps> = ({
|
|
6
|
-
value,
|
|
7
|
-
label,
|
|
8
|
-
onSelect,
|
|
9
|
-
selectedValue,
|
|
10
|
-
showListDivider = true,
|
|
11
|
-
}) => {
|
|
12
|
-
const handleClick = () => {
|
|
13
|
-
if (onSelect && typeof onSelect === 'function') {
|
|
14
|
-
onSelect(value);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
|
|
5
|
+
export const NsDropdownOption: React.FC<DropdownOptionProps> = ({ value, children }) => {
|
|
18
6
|
return (
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
</
|
|
7
|
+
<ListItem data-testid={`option-${value}`} id="dropdown-item">
|
|
8
|
+
{children}
|
|
9
|
+
</ListItem>
|
|
22
10
|
);
|
|
23
11
|
};
|
|
24
12
|
export default NsDropdownOption;
|
|
@@ -20,7 +20,6 @@ export default {
|
|
|
20
20
|
},
|
|
21
21
|
placeholder: { control: 'text' },
|
|
22
22
|
closeOnMouseLeave: { control: 'boolean' },
|
|
23
|
-
showListDivider: { control: 'boolean' },
|
|
24
23
|
},
|
|
25
24
|
parameters: {
|
|
26
25
|
options: [
|
|
@@ -34,19 +33,16 @@ export default {
|
|
|
34
33
|
disabled: false,
|
|
35
34
|
dropdownBorderColor: 'primary',
|
|
36
35
|
closeOnMouseLeave: false,
|
|
37
|
-
showListDivider: true,
|
|
38
|
-
selectedValue: '',
|
|
39
36
|
selectedLabel: '',
|
|
37
|
+
placeholder: 'options',
|
|
40
38
|
},
|
|
41
39
|
} as MetaStory;
|
|
42
40
|
|
|
43
41
|
const RenderStory = (args: any, context: any) => {
|
|
44
42
|
const [selectedLabel, setSelectedLabel] = useState(args.selectedLabel);
|
|
45
|
-
const [selectedValue, setSelectedValue] = useState(args.selectedValue);
|
|
46
43
|
|
|
47
44
|
const options = context.parameters.options;
|
|
48
45
|
const handleSelect = (value: string) => {
|
|
49
|
-
setSelectedValue(value);
|
|
50
46
|
options.find((option: any) => {
|
|
51
47
|
if (option.value === value) {
|
|
52
48
|
setSelectedLabel(option.label);
|
|
@@ -55,9 +51,11 @@ const RenderStory = (args: any, context: any) => {
|
|
|
55
51
|
};
|
|
56
52
|
|
|
57
53
|
return (
|
|
58
|
-
<NsDropdown {...args}
|
|
54
|
+
<NsDropdown {...args} selectedLabel={selectedLabel} onSelect={handleSelect}>
|
|
59
55
|
{options.map((option: any) => (
|
|
60
|
-
<NsDropdownOption key={option.value} value={option.value}
|
|
56
|
+
<NsDropdownOption key={option.value} value={option.value}>
|
|
57
|
+
{option.label}
|
|
58
|
+
</NsDropdownOption>
|
|
61
59
|
))}
|
|
62
60
|
</NsDropdown>
|
|
63
61
|
);
|
|
@@ -20,7 +20,6 @@ export default {
|
|
|
20
20
|
},
|
|
21
21
|
placeholder: { control: 'text' },
|
|
22
22
|
closeOnMouseLeave: { control: 'boolean' },
|
|
23
|
-
showListDivider: { control: 'boolean' },
|
|
24
23
|
},
|
|
25
24
|
parameters: {
|
|
26
25
|
options: [
|
|
@@ -30,23 +29,19 @@ export default {
|
|
|
30
29
|
],
|
|
31
30
|
},
|
|
32
31
|
args: {
|
|
33
|
-
selectedValue: 'english',
|
|
34
32
|
selectedLabel: 'United States (US) | English',
|
|
35
33
|
type: 'unfilled',
|
|
36
34
|
disabled: false,
|
|
37
35
|
dropdownBorderColor: 'accentColorB',
|
|
38
36
|
closeOnMouseLeave: true,
|
|
39
|
-
showListDivider: true,
|
|
40
37
|
},
|
|
41
38
|
} as MetaStory;
|
|
42
39
|
|
|
43
40
|
const RenderStory = (args: any, context: any) => {
|
|
44
41
|
const [selectedLabel, setSelectedLabel] = useState(args.selectedLabel);
|
|
45
|
-
const [selectedValue, setSelectedValue] = useState(args.selectedValue);
|
|
46
42
|
|
|
47
43
|
const options = context.parameters.options;
|
|
48
44
|
const handleSelect = (value: string) => {
|
|
49
|
-
setSelectedValue(value);
|
|
50
45
|
options.find((option: any) => {
|
|
51
46
|
if (option.value === value) {
|
|
52
47
|
setSelectedLabel(`${option.country} | ${option.label}`);
|
|
@@ -55,9 +50,11 @@ const RenderStory = (args: any, context: any) => {
|
|
|
55
50
|
};
|
|
56
51
|
|
|
57
52
|
return (
|
|
58
|
-
<NsDropdown {...args}
|
|
53
|
+
<NsDropdown {...args} selectedLabel={selectedLabel} onSelect={handleSelect}>
|
|
59
54
|
{options.map((option: any) => (
|
|
60
|
-
<NsDropdownOption key={option.value} value={option.value}
|
|
55
|
+
<NsDropdownOption key={option.value} value={option.value}>
|
|
56
|
+
{option.label}
|
|
57
|
+
</NsDropdownOption>
|
|
61
58
|
))}
|
|
62
59
|
</NsDropdown>
|
|
63
60
|
);
|
|
@@ -4,22 +4,20 @@ import { FoundationTheme } from '@nuskin/foundation-theme';
|
|
|
4
4
|
import { AdditionalProps } from '../common.types';
|
|
5
5
|
|
|
6
6
|
export interface DropdownProps extends AdditionalProps {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
children: ReactNode;
|
|
7
|
+
selectedLabel: ReactNode;
|
|
8
|
+
onSelect: (arg: ReactNode) => void; // eslint-disable-line
|
|
9
|
+
children: ReactNode[];
|
|
11
10
|
disabled?: boolean;
|
|
12
11
|
type?: 'outlined' | 'unfilled';
|
|
13
12
|
placeholder?: string;
|
|
14
13
|
dropdownBorderColor?: FoundationTheme.PaletteColors;
|
|
15
14
|
closeOnMouseLeave?: boolean;
|
|
16
15
|
showListDivider?: boolean;
|
|
16
|
+
className?: string;
|
|
17
|
+
placeholder?: string;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
export interface DropdownOptionProps {
|
|
20
21
|
value: string;
|
|
21
|
-
|
|
22
|
-
selectedValue?: string;
|
|
23
|
-
onSelect?: (arg: string) => void; // eslint-disable-line
|
|
24
|
-
showListDivider?: boolean;
|
|
22
|
+
children: ReactNode;
|
|
25
23
|
}
|
|
@@ -17,6 +17,7 @@ export const NavTitles = ({ tabs, setActive, active, tabTitleClassName }: NavTit
|
|
|
17
17
|
additionalProps={{ ...tab?.liveTag }}
|
|
18
18
|
className={`${tabTitleClassName} ${!active ? 'opacity-8' : ''}`}
|
|
19
19
|
color={tab.tabName === active ? tab.activeColor : tab.color}
|
|
20
|
+
noSpacing
|
|
20
21
|
>
|
|
21
22
|
{tab.tabName}
|
|
22
23
|
</NsTypography>
|
|
@@ -44,9 +45,9 @@ export const NavTitles = ({ tabs, setActive, active, tabTitleClassName }: NavTit
|
|
|
44
45
|
animate
|
|
45
46
|
>
|
|
46
47
|
{tab?.tabLink ? (
|
|
47
|
-
<
|
|
48
|
-
<
|
|
49
|
-
</
|
|
48
|
+
<NavTitleTypography {...tab} >
|
|
49
|
+
<NsLink href={tab.tabLink} underlineOnHover={false} />
|
|
50
|
+
</NavTitleTypography>
|
|
50
51
|
) : (
|
|
51
52
|
<NavTitleTypography {...tab} />
|
|
52
53
|
)}
|
|
@@ -33,7 +33,7 @@ const NsTextStrip = (props: NsTextStripProps) => {
|
|
|
33
33
|
|
|
34
34
|
return (
|
|
35
35
|
<StyledHeader className={`${className} items-${alignment}`}>
|
|
36
|
-
<NsTypography variant="
|
|
36
|
+
<NsTypography variant="title-m" className="tracking-normal">
|
|
37
37
|
{text}
|
|
38
38
|
</NsTypography>
|
|
39
39
|
<NsTypography variant="body-xs">
|
|
@@ -170,7 +170,7 @@ const getVariantStyle = (
|
|
|
170
170
|
|
|
171
171
|
export const StyledTypography = styled('div')<NsTypographyProps>(
|
|
172
172
|
({ theme, weight, variant, noSpacing, decoration, color, colorOverride }) => {
|
|
173
|
-
const fontStyles: TypographyConfig = getVariantStyle(theme
|
|
173
|
+
const fontStyles: TypographyConfig = getVariantStyle(theme?.fonts?.typographyVariants, variant) || {};
|
|
174
174
|
if (noSpacing) {
|
|
175
175
|
fontStyles.paragraphSpacing = 0;
|
|
176
176
|
}
|