@nuskin/foundation-ui-components 1.8.1-738-v2.2 → 1.9.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 +1 -1
- package/src/common/autocomplete/helper/AutoCompleteButton.tsx +1 -1
- package/src/common/autocomplete/helper/renderGroupName.tsx +1 -1
- package/src/common/autocomplete/mock/MockUI.tsx +1 -1
- package/src/common/banner/NsBanner.stories.tsx +1 -1
- package/src/common/card/NsAwardCard.tsx +71 -0
- package/src/common/card/NsLargeCard.tsx +14 -9
- package/src/common/card/NsMediumCard.tsx +21 -6
- package/src/common/card/NsPost.tsx +4 -7
- package/src/common/card/index.ts +1 -0
- package/src/common/card/stories/NsAwardCard.stories.tsx +26 -0
- package/src/common/card/stories/NsLargeCard.stories.tsx +5 -4
- package/src/common/card/stories/NsMediumCard.stories.tsx +7 -3
- package/src/common/card/stories/NsPost.stories.tsx +2 -2
- package/src/common/checkbox/NsCheckbox.tsx +1 -1
- package/src/common/link/NsLink.stories.tsx +2 -2
- package/src/common/modal/helper-component/NsModalContentBox.tsx +1 -1
- package/src/common/modal/stories/mock.tsx +1 -1
- package/src/common/nav-product-card/NsNavProductCard.tsx +1 -1
- package/src/common/nav-tab/NavTitles.tsx +20 -10
- package/src/common/nav-tab/types.d.ts +1 -0
- package/src/common/progress/NsProgress.tsx +1 -1
- package/src/common/text-strip/NsTextStrip.tsx +1 -1
- package/src/common/typography/HtmlTagVariantMap.tsx +24 -0
- package/src/common/typography/NsTypography.stories.tsx +1 -0
- package/src/common/typography/NsTypography.tsx +7 -2
- package/src/common/typography/Typography.styled.tsx +12 -10
- package/src/common/typography/types.d.ts +15 -8
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@ export const AutoCompleteButton = (props: AutoCompleteButtonProps) => {
|
|
|
15
15
|
return (
|
|
16
16
|
<li className="text-right p-3">
|
|
17
17
|
<NsButton onClick={onClick} data-testid={testId}>
|
|
18
|
-
<NsTypography variant="
|
|
18
|
+
<NsTypography variant="body-xs" weight="bold">
|
|
19
19
|
{text}
|
|
20
20
|
</NsTypography>
|
|
21
21
|
</NsButton>
|
|
@@ -5,7 +5,7 @@ import { NsTypography, OptionsProps } from '../..';
|
|
|
5
5
|
export const renderGroupName = ({ key, group, children }: AutocompleteRenderGroupParams) => (
|
|
6
6
|
<li key={key}>
|
|
7
7
|
{group ? (
|
|
8
|
-
<NsTypography variant="
|
|
8
|
+
<NsTypography variant="body-m" weight="bold" className="p-3">
|
|
9
9
|
{group}
|
|
10
10
|
</NsTypography>
|
|
11
11
|
) : null}
|
|
@@ -8,7 +8,7 @@ const OptionUiComponent = ({ option }: ListUiProps) => {
|
|
|
8
8
|
return (
|
|
9
9
|
<ListStyled>
|
|
10
10
|
<div className="item-description" role="link" tabIndex={0}>
|
|
11
|
-
<NsTypography aria-label="Nu Skin Tumbler" variant="
|
|
11
|
+
<NsTypography aria-label="Nu Skin Tumbler" variant="body-m" colorOverride="#63666A">
|
|
12
12
|
<img src={option.image} alt="No-image" />
|
|
13
13
|
{option?.value}
|
|
14
14
|
</NsTypography>
|
|
@@ -32,7 +32,7 @@ export default {
|
|
|
32
32
|
<NsTypography className="w-80" variant="h1" colorOverride="#000000">
|
|
33
33
|
Limited time offers on LumiSpa iO cleansers and bundles!
|
|
34
34
|
</NsTypography>
|
|
35
|
-
<NsTypography variant="
|
|
35
|
+
<NsTypography variant="body-m" className="my-5" colorOverride="#000000">
|
|
36
36
|
Learn more about what I do and how I can help you
|
|
37
37
|
</NsTypography>
|
|
38
38
|
<NsButton variant="contained">Contact me</NsButton>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import Box from '@mui/material/Box';
|
|
2
|
+
import { styled } from '@nuskin/foundation-theme';
|
|
3
|
+
import { NsImage } from '..';
|
|
4
|
+
|
|
5
|
+
type NsAwardCardProps = {
|
|
6
|
+
title: string;
|
|
7
|
+
awardName: string;
|
|
8
|
+
mediaOutlet: string;
|
|
9
|
+
backgroundImageUrl: string;
|
|
10
|
+
backgroundImageAlt: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const CardContainer = styled(Box)(() => {
|
|
14
|
+
return {
|
|
15
|
+
display: 'flex',
|
|
16
|
+
flexDirection: 'column',
|
|
17
|
+
position: 'relative',
|
|
18
|
+
backgroundColor: '#fff',
|
|
19
|
+
alignItems: 'center',
|
|
20
|
+
'.image': {
|
|
21
|
+
width: '150px',
|
|
22
|
+
height: 'auto',
|
|
23
|
+
objectFit: 'cover',
|
|
24
|
+
backgroundColor: 'red',
|
|
25
|
+
},
|
|
26
|
+
'.content': {
|
|
27
|
+
display: 'flex',
|
|
28
|
+
flexDirection: 'column',
|
|
29
|
+
alignItems: 'center',
|
|
30
|
+
},
|
|
31
|
+
'.title': {
|
|
32
|
+
fontSize: '16px',
|
|
33
|
+
fontWeight: 'bold',
|
|
34
|
+
marginTop: '30px',
|
|
35
|
+
},
|
|
36
|
+
'.awardName': {
|
|
37
|
+
fontSize: '16px',
|
|
38
|
+
fontWeight: '400',
|
|
39
|
+
marginTop: '20px',
|
|
40
|
+
},
|
|
41
|
+
'.mediaOutlet': {
|
|
42
|
+
fontSize: '11px',
|
|
43
|
+
fontWeight: '400',
|
|
44
|
+
marginTop: '20px',
|
|
45
|
+
},
|
|
46
|
+
'.action-link': {
|
|
47
|
+
marginTop: '10px',
|
|
48
|
+
fontSize: '14px',
|
|
49
|
+
alignSelf: 'start',
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export default function NsAwardCard({
|
|
55
|
+
title,
|
|
56
|
+
awardName,
|
|
57
|
+
mediaOutlet,
|
|
58
|
+
backgroundImageUrl,
|
|
59
|
+
backgroundImageAlt,
|
|
60
|
+
}: NsAwardCardProps) {
|
|
61
|
+
return (
|
|
62
|
+
<CardContainer role="award-card" component="div" data-testid="award-card">
|
|
63
|
+
<NsImage alt={backgroundImageAlt} src={backgroundImageUrl} className="image" />
|
|
64
|
+
<div className="content">
|
|
65
|
+
<article className="title">{title}</article>
|
|
66
|
+
<article className="awardName">{awardName}</article>
|
|
67
|
+
<article className="mediaOutlet">{mediaOutlet}</article>
|
|
68
|
+
</div>
|
|
69
|
+
</CardContainer>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
@@ -4,9 +4,10 @@ import { NsButton, NsIcon, NsImage, NsLink, NsIconNameType } from '..';
|
|
|
4
4
|
|
|
5
5
|
type NsLargeCardProps = {
|
|
6
6
|
title: string;
|
|
7
|
-
subtitle
|
|
7
|
+
subtitle?: string;
|
|
8
8
|
intro: string;
|
|
9
|
-
icon
|
|
9
|
+
icon?: NsIconNameType;
|
|
10
|
+
buttonVariant: 'text' | 'outlined' | 'contained';
|
|
10
11
|
backgroundImageUrl: string;
|
|
11
12
|
backgroundImageAlt: string;
|
|
12
13
|
cardLink: { href: string; title: string };
|
|
@@ -14,16 +15,16 @@ type NsLargeCardProps = {
|
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
const CardContainer = styled((props: any) => <Box {...props} />)(({ isHorizontal }) => {
|
|
17
|
-
let width = '
|
|
18
|
+
let width = '375px',
|
|
18
19
|
paddingLeft = '0px',
|
|
19
20
|
justifyContent,
|
|
20
|
-
fontSizeSub = '
|
|
21
|
+
fontSizeSub = '16px',
|
|
21
22
|
fontSizeTitle = '26px';
|
|
22
23
|
|
|
23
24
|
if (isHorizontal) {
|
|
24
|
-
width = '
|
|
25
|
+
width = 'unset';
|
|
25
26
|
paddingLeft = '30px';
|
|
26
|
-
justifyContent = '
|
|
27
|
+
justifyContent = 'center';
|
|
27
28
|
fontSizeSub = '16px';
|
|
28
29
|
fontSizeTitle = '36px';
|
|
29
30
|
}
|
|
@@ -33,15 +34,15 @@ const CardContainer = styled((props: any) => <Box {...props} />)(({ isHorizontal
|
|
|
33
34
|
display: 'flex',
|
|
34
35
|
flexDirection: direction,
|
|
35
36
|
position: 'relative',
|
|
37
|
+
width,
|
|
36
38
|
'.image': {
|
|
37
39
|
width: '375px',
|
|
38
|
-
height: '
|
|
40
|
+
height: 'auto',
|
|
39
41
|
objectFit: 'cover',
|
|
40
42
|
},
|
|
41
43
|
'.content': {
|
|
42
44
|
display: 'flex',
|
|
43
45
|
flexDirection: 'column',
|
|
44
|
-
width,
|
|
45
46
|
paddingLeft,
|
|
46
47
|
justifyContent,
|
|
47
48
|
},
|
|
@@ -59,6 +60,7 @@ const CardContainer = styled((props: any) => <Box {...props} />)(({ isHorizontal
|
|
|
59
60
|
display: 'flex',
|
|
60
61
|
flexDirection: 'column' as 'column',
|
|
61
62
|
width: 'fit-content',
|
|
63
|
+
|
|
62
64
|
borderBottom: '1px solid black',
|
|
63
65
|
':hover': {
|
|
64
66
|
opacity: '0.8',
|
|
@@ -68,6 +70,7 @@ const CardContainer = styled((props: any) => <Box {...props} />)(({ isHorizontal
|
|
|
68
70
|
marginTop: '10px',
|
|
69
71
|
display: 'flex',
|
|
70
72
|
fontWeight: 600,
|
|
73
|
+
width: 'fit-content',
|
|
71
74
|
':hover': {
|
|
72
75
|
textDecoration: 'none',
|
|
73
76
|
},
|
|
@@ -84,6 +87,7 @@ export default function NsLargeCard({
|
|
|
84
87
|
backgroundImageUrl,
|
|
85
88
|
backgroundImageAlt,
|
|
86
89
|
cardLink,
|
|
90
|
+
buttonVariant,
|
|
87
91
|
intro,
|
|
88
92
|
icon,
|
|
89
93
|
isHorizontal,
|
|
@@ -105,11 +109,12 @@ export default function NsLargeCard({
|
|
|
105
109
|
) : (
|
|
106
110
|
<NsButton
|
|
107
111
|
className="action-link"
|
|
108
|
-
variant=
|
|
112
|
+
variant={buttonVariant}
|
|
109
113
|
color="primary"
|
|
110
114
|
href={cardLink.href}
|
|
111
115
|
fullWidth={false}
|
|
112
116
|
darkModeEnabled={false}
|
|
117
|
+
endIcon={buttonVariant !== 'contained' ? <NsIcon className="icon" name={icon} /> : null}
|
|
113
118
|
>
|
|
114
119
|
{cardLink.title}
|
|
115
120
|
</NsButton>
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import Box from '@mui/material/Box';
|
|
2
2
|
import { styled } from '@nuskin/foundation-theme';
|
|
3
|
-
import { NsButton, NsImage } from '..';
|
|
3
|
+
import { NsButton, NsIcon, NsIconNameType, NsImage, NsTypography } from '..';
|
|
4
4
|
|
|
5
5
|
type NsMediumCardProps = {
|
|
6
6
|
title: string;
|
|
7
|
+
titleFontWeight?: 'bold' | 'normal' | 'light';
|
|
7
8
|
subtitle: string;
|
|
9
|
+
icon?: NsIconNameType;
|
|
8
10
|
backgroundImageUrl: string;
|
|
9
11
|
backgroundImageAlt: string;
|
|
12
|
+
buttonVariant: 'text' | 'outlined' | 'contained';
|
|
10
13
|
cardLink: { href: string; title: string };
|
|
11
14
|
};
|
|
12
15
|
|
|
@@ -22,16 +25,16 @@ const CardContainer = styled(Box)(() => {
|
|
|
22
25
|
},
|
|
23
26
|
'.content': {
|
|
24
27
|
display: 'flex',
|
|
28
|
+
width: '300px',
|
|
25
29
|
flexDirection: 'column',
|
|
26
30
|
},
|
|
27
31
|
'.subtitle': {
|
|
28
|
-
fontSize: '
|
|
32
|
+
fontSize: '16px',
|
|
29
33
|
fontWeight: '400',
|
|
30
34
|
marginTop: '10px',
|
|
31
35
|
},
|
|
32
36
|
'.title': {
|
|
33
|
-
fontSize: '
|
|
34
|
-
fontWeight: '400',
|
|
37
|
+
fontSize: '20px',
|
|
35
38
|
marginTop: '10px',
|
|
36
39
|
},
|
|
37
40
|
'.action-link': {
|
|
@@ -44,18 +47,30 @@ const CardContainer = styled(Box)(() => {
|
|
|
44
47
|
|
|
45
48
|
export default function NsMediumCard({
|
|
46
49
|
title,
|
|
50
|
+
titleFontWeight,
|
|
47
51
|
subtitle,
|
|
48
52
|
backgroundImageUrl,
|
|
49
53
|
backgroundImageAlt,
|
|
50
54
|
cardLink,
|
|
55
|
+
icon,
|
|
56
|
+
buttonVariant,
|
|
51
57
|
}: NsMediumCardProps) {
|
|
52
58
|
return (
|
|
53
59
|
<CardContainer role="medium-card" component="div" data-testid="medium-card">
|
|
54
60
|
<NsImage alt={backgroundImageAlt} src={backgroundImageUrl} className="image" />
|
|
55
61
|
<div className="content">
|
|
56
|
-
<
|
|
62
|
+
<NsTypography variant="h5" color="primary" className="title" weight={titleFontWeight}>
|
|
63
|
+
{title}
|
|
64
|
+
</NsTypography>
|
|
57
65
|
<article className="subtitle">{subtitle}</article>
|
|
58
|
-
<NsButton
|
|
66
|
+
<NsButton
|
|
67
|
+
className="action-link"
|
|
68
|
+
variant={buttonVariant}
|
|
69
|
+
color="primary"
|
|
70
|
+
href={cardLink.href}
|
|
71
|
+
fullWidth={false}
|
|
72
|
+
endIcon={buttonVariant !== 'contained' ? <NsIcon className="icon" name={icon} /> : null}
|
|
73
|
+
>
|
|
59
74
|
{cardLink.title}
|
|
60
75
|
</NsButton>
|
|
61
76
|
</div>
|
|
@@ -19,17 +19,14 @@ const CardContainer = styled(Box)(() => {
|
|
|
19
19
|
position: 'relative',
|
|
20
20
|
overflow: 'hidden',
|
|
21
21
|
height: 'auto',
|
|
22
|
-
width: '
|
|
22
|
+
width: '200px',
|
|
23
23
|
backgroundColor: '#fff',
|
|
24
|
-
'.image': {
|
|
25
|
-
width: '100%',
|
|
26
|
-
height: '180px',
|
|
27
|
-
display: 'block',
|
|
28
|
-
},
|
|
29
24
|
'.content': {
|
|
30
|
-
padding: '
|
|
25
|
+
padding: '10px',
|
|
31
26
|
display: 'flex',
|
|
32
27
|
flexDirection: 'column',
|
|
28
|
+
minHeight: '150px',
|
|
29
|
+
justifyContent: 'space-between',
|
|
33
30
|
},
|
|
34
31
|
'.body-title': {
|
|
35
32
|
fontSize: '18px',
|
package/src/common/card/index.ts
CHANGED
|
@@ -11,3 +11,4 @@ export { default as NsSmallFullCard } from './NsSmallFullCard';
|
|
|
11
11
|
export { default as NsXLargeCard } from './NsXLargeCard';
|
|
12
12
|
export { default as NsLargeCard } from './NsLargeCard';
|
|
13
13
|
export { default as NsMediumCard } from './NsMediumCard';
|
|
14
|
+
export { default as NsAwardCard } from './NsAwardCard';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { StoryObj, Meta } from '@storybook/react';
|
|
2
|
+
import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
|
|
3
|
+
import { NsAwardCard } from '../';
|
|
4
|
+
|
|
5
|
+
type ComponentType = typeof NsAwardCard;
|
|
6
|
+
type Story = StoryObj<ComponentType>;
|
|
7
|
+
type MetaStory = Meta<ComponentType>;
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
component: NsAwardCard,
|
|
11
|
+
title: 'Components/Containers/Card/NsAwardCard',
|
|
12
|
+
argTypes: {},
|
|
13
|
+
decorators: [withCenterDecorator],
|
|
14
|
+
} as MetaStory;
|
|
15
|
+
|
|
16
|
+
const host = 'https://media.nuskin.com';
|
|
17
|
+
|
|
18
|
+
export const Default: Story = {
|
|
19
|
+
args: {
|
|
20
|
+
title: 'AgeLoc LumiSpa iO',
|
|
21
|
+
awardName: '2023 Bronze Winner',
|
|
22
|
+
mediaOutlet: 'Edison Awards',
|
|
23
|
+
backgroundImageUrl: `${host}/m/2ec571a87dc9680c/Small-Edison-Bronze-Logo-Homepage.jpg`,
|
|
24
|
+
backgroundImageAlt: 'Edison Bronze Logo',
|
|
25
|
+
},
|
|
26
|
+
};
|
|
@@ -18,15 +18,16 @@ const host = 'https://media.nuskin.com';
|
|
|
18
18
|
export const Default: Story = {
|
|
19
19
|
args: {
|
|
20
20
|
isHorizontal: false,
|
|
21
|
-
title: '
|
|
21
|
+
title: 'Personal Care',
|
|
22
22
|
subtitle: 'Subtitle',
|
|
23
|
-
intro: '
|
|
23
|
+
intro: 'Nu Skin® product lines combine nature and science for skincare benefits you can see and feel.',
|
|
24
24
|
icon: 'cart',
|
|
25
25
|
cardLink: {
|
|
26
26
|
href: 'https://www.forceforgood.org/',
|
|
27
|
-
title: '
|
|
27
|
+
title: 'REVEAL YOUR BEST SKIN',
|
|
28
28
|
},
|
|
29
|
-
|
|
29
|
+
buttonVariant: 'outlined',
|
|
30
|
+
backgroundImageUrl: `${host}/m/95f9cf4143e3882/Small-About_Us-Personal-Care-Products-Image.jpg`,
|
|
30
31
|
backgroundImageAlt: 'Facial Moisturizers',
|
|
31
32
|
},
|
|
32
33
|
};
|
|
@@ -17,12 +17,16 @@ const host = 'https://media.nuskin.com';
|
|
|
17
17
|
|
|
18
18
|
export const Default: Story = {
|
|
19
19
|
args: {
|
|
20
|
-
title: '
|
|
21
|
-
|
|
20
|
+
title: 'Sustainability',
|
|
21
|
+
titleFontWeight: 'bold',
|
|
22
|
+
subtitle:
|
|
23
|
+
'We’re committed to keeping our global communities clean, safe, and protected for the future. We’re proud to embrace sustainable practices today for a resource-rich tomorrow.',
|
|
22
24
|
cardLink: {
|
|
23
25
|
href: 'https://www.forceforgood.org/',
|
|
24
|
-
title: '
|
|
26
|
+
title: 'SEE WHAT WE’RE DOING',
|
|
25
27
|
},
|
|
28
|
+
icon: 'arrowRight',
|
|
29
|
+
buttonVariant: 'outlined',
|
|
26
30
|
backgroundImageUrl: `${host}/m/3353b9c05cb83860/Small-category-facial_moisturizers.jpg`,
|
|
27
31
|
backgroundImageAlt: 'Lumi Spa',
|
|
28
32
|
},
|
|
@@ -15,8 +15,8 @@ export default {
|
|
|
15
15
|
decorators: [withCenterDecorator],
|
|
16
16
|
} as MetaStory;
|
|
17
17
|
|
|
18
|
-
const text = '
|
|
19
|
-
const body = '
|
|
18
|
+
const text = '38 New Beauty Products Our Editors Are Loving';
|
|
19
|
+
const body = 'SPA & BEAUTY TODAY';
|
|
20
20
|
const host = 'https://media.nuskin.com/';
|
|
21
21
|
|
|
22
22
|
export const Default: Story = {
|
|
@@ -52,7 +52,7 @@ const NsCheckbox = (props: PropsWithChildren<NsCheckboxProps>) => {
|
|
|
52
52
|
|
|
53
53
|
const renderCheckboxLabel = useCallback(
|
|
54
54
|
() => (
|
|
55
|
-
<NsTypography variant="
|
|
55
|
+
<NsTypography variant="body-l">
|
|
56
56
|
<StyledFlagLabel {...flag} size={size} testId={`${name}-flag-label`} />
|
|
57
57
|
<StyledLabel className="checkbox-label-text" isDisabled={disabled}>
|
|
58
58
|
{label}
|
|
@@ -36,7 +36,7 @@ export default {
|
|
|
36
36
|
|
|
37
37
|
export const Links: Story = {
|
|
38
38
|
render: (args: any) => (
|
|
39
|
-
<NsTypography variant="
|
|
39
|
+
<NsTypography variant="title-l">
|
|
40
40
|
<NsLink {...args} href={args.href} />
|
|
41
41
|
</NsTypography>
|
|
42
42
|
),
|
|
@@ -45,7 +45,7 @@ export const Links: Story = {
|
|
|
45
45
|
export const ReactComponentLink: Story = {
|
|
46
46
|
render: (args: any) => (
|
|
47
47
|
<NsLink {...args} href={args.href} passHref>
|
|
48
|
-
<NsTypography variant="
|
|
48
|
+
<NsTypography variant="title-l">Test Link</NsTypography>
|
|
49
49
|
</NsLink>
|
|
50
50
|
),
|
|
51
51
|
};
|
|
@@ -23,7 +23,7 @@ const NsModalContentBox = ({ handleClose, statusInfo }: NsModalComponentProps) =
|
|
|
23
23
|
<div>
|
|
24
24
|
<NsModalTitle header={header} handleClose={handleClose} />
|
|
25
25
|
<DialogContent>
|
|
26
|
-
<NsTypography variant="
|
|
26
|
+
<NsTypography variant="body-xs">{description}</NsTypography>
|
|
27
27
|
</DialogContent>
|
|
28
28
|
</div>
|
|
29
29
|
);
|
|
@@ -18,7 +18,7 @@ export const NsModalData = {
|
|
|
18
18
|
body: {
|
|
19
19
|
show: true,
|
|
20
20
|
children: (
|
|
21
|
-
<NsTypography variant="
|
|
21
|
+
<NsTypography variant="body-s">
|
|
22
22
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquet sed odio donec tellus nibh dictum quis.
|
|
23
23
|
Dis tempus aliquam tristique auctor justo, lacus in pellentesque. Quam semper facilisi posuere hendrerit
|
|
24
24
|
scelerisque sed.
|
|
@@ -18,7 +18,7 @@ export const NsNavProductCard = ({
|
|
|
18
18
|
<NsTypography variant="h5" color="primary" className="mt-11 mb-3.5 underline-hover" weight="bold">
|
|
19
19
|
{productName}
|
|
20
20
|
</NsTypography>
|
|
21
|
-
<NsTypography variant="
|
|
21
|
+
<NsTypography variant="body-s" color="primary" weight="light">
|
|
22
22
|
{productDescription}
|
|
23
23
|
</NsTypography>
|
|
24
24
|
</div>
|
|
@@ -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:
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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} />
|
|
@@ -7,7 +7,7 @@ const NsProgress = (props: NsProgressProps) => {
|
|
|
7
7
|
const { barColor, backgroundColor, height, value, body } = props;
|
|
8
8
|
return (
|
|
9
9
|
<StyledProgress className="ns-progress">
|
|
10
|
-
<ProgressInfo variant="
|
|
10
|
+
<ProgressInfo variant="body-xs" className="progress-info">
|
|
11
11
|
{value}
|
|
12
12
|
<span>{body ?? ' % Complete'}</span>
|
|
13
13
|
</ProgressInfo>
|
|
@@ -36,7 +36,7 @@ const NsTextStrip = (props: NsTextStripProps) => {
|
|
|
36
36
|
<NsTypography variant="h5" weight="bold">
|
|
37
37
|
{text}
|
|
38
38
|
</NsTypography>
|
|
39
|
-
<NsTypography variant="
|
|
39
|
+
<NsTypography variant="body-xs">
|
|
40
40
|
{description}
|
|
41
41
|
{link?.href ? <NsLink href={link.href}>{link.title}</NsLink> : ''}
|
|
42
42
|
</NsTypography>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { HtmlTagVariant } from './types';
|
|
2
|
+
|
|
3
|
+
const HtmlTagVariantMapping: Record<string, HtmlTagVariant> = {
|
|
4
|
+
h1: 'h1',
|
|
5
|
+
h2: 'h2',
|
|
6
|
+
h3: 'h3',
|
|
7
|
+
h4: 'h4',
|
|
8
|
+
h5: 'h5',
|
|
9
|
+
h6: 'h6',
|
|
10
|
+
CTA: 'span',
|
|
11
|
+
'title-l': 'h3',
|
|
12
|
+
'title-m': 'h5',
|
|
13
|
+
'title-s': 'h6',
|
|
14
|
+
'label-l': 'label',
|
|
15
|
+
'label-m': 'label',
|
|
16
|
+
'label-s': 'label',
|
|
17
|
+
'body-xl': 'p',
|
|
18
|
+
'body-l': 'p',
|
|
19
|
+
'body-m': 'p',
|
|
20
|
+
'body-s': 'p',
|
|
21
|
+
'body-xs': 'p',
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default HtmlTagVariantMapping;
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from 'react';
|
|
2
|
-
import { NsTypographyProps } from './types.d';
|
|
2
|
+
import { HtmlTagVariant, NsTypographyProps } from './types.d';
|
|
3
3
|
import { StyledTypography } from './Typography.styled';
|
|
4
|
+
import HtmlTagVariantMapping from './HtmlTagVariantMap';
|
|
4
5
|
|
|
5
6
|
const NsTypography = ({
|
|
6
7
|
children,
|
|
7
8
|
fontStyle = 'normal',
|
|
8
9
|
weight = 'normal',
|
|
9
10
|
className = '',
|
|
10
|
-
variant = '
|
|
11
|
+
variant = 'body-l',
|
|
11
12
|
decoration = 'none',
|
|
12
13
|
color = 'primary',
|
|
13
14
|
additionalProps = {},
|
|
14
15
|
colorOverride = '',
|
|
16
|
+
renderHTMLNode,
|
|
15
17
|
}: PropsWithChildren<NsTypographyProps>) => {
|
|
18
|
+
const htmlTagVariant: HtmlTagVariant | undefined = renderHTMLNode ? HtmlTagVariantMapping[variant] : undefined;
|
|
19
|
+
|
|
16
20
|
return (
|
|
17
21
|
<StyledTypography
|
|
22
|
+
as={htmlTagVariant}
|
|
18
23
|
fontStyle={fontStyle}
|
|
19
24
|
className={className}
|
|
20
25
|
weight={weight}
|
|
@@ -10,14 +10,17 @@ const variantStyles = {
|
|
|
10
10
|
h4: 'font-size: 18px; line-height: 26px',
|
|
11
11
|
h5: 'font-size: 16px; line-height: 22px',
|
|
12
12
|
h6: 'font-size: 14px; line-height: 20px',
|
|
13
|
-
'
|
|
14
|
-
'
|
|
15
|
-
'
|
|
16
|
-
'
|
|
17
|
-
'
|
|
18
|
-
'
|
|
19
|
-
'
|
|
20
|
-
'
|
|
13
|
+
'title-l': 'font-size: 22px; line-height: 28px; font-weight:bold',
|
|
14
|
+
'title-m': 'font-size: 16px; line-height: 20px; font-weight:bold',
|
|
15
|
+
'title-s': 'font-size: 16px; line-height: 16px; font-weight:bold',
|
|
16
|
+
'label-l': 'font-size: 20px; line-height: 26px; font-weight:600',
|
|
17
|
+
'label-m': 'font-size: 16px; line-height: 22px; font-weight:600',
|
|
18
|
+
'label-s': 'font-size: 14px; line-height: 20px; font-weight:700',
|
|
19
|
+
'body-xl': 'font-size: 18px; line-height: 22px',
|
|
20
|
+
'body-l': 'font-size: 16px; line-height: 22px',
|
|
21
|
+
'body-m': 'font-size: 14px; line-height: 20px',
|
|
22
|
+
'body-s': 'font-size: 12px; line-height: 16px',
|
|
23
|
+
'body-xs': 'font-size: 10px; line-height: 15px',
|
|
21
24
|
CTA: 'font-size: 11px; line-height: 16px',
|
|
22
25
|
};
|
|
23
26
|
|
|
@@ -29,8 +32,7 @@ const fontWeightMap = {
|
|
|
29
32
|
|
|
30
33
|
export const StyledTypography = styled.div<NsTypographyProps>`
|
|
31
34
|
font-family: Inter;
|
|
32
|
-
color: ${({ color, colorOverride }) =>
|
|
33
|
-
colorOverride?.startsWith('#') ? colorOverride : paletteColor(color)};
|
|
35
|
+
color: ${({ color, colorOverride }) => (colorOverride?.startsWith('#') ? colorOverride : paletteColor(color))};
|
|
34
36
|
font-weight: ${({ weight = 'normal' }) => fontWeightMap[weight]};
|
|
35
37
|
font-style: ${({ fontStyle }) => fontStyle};
|
|
36
38
|
${({ variant = 'h1' }) => variantStyles[variant]};
|
|
@@ -8,16 +8,21 @@ export type Variants =
|
|
|
8
8
|
| 'h4'
|
|
9
9
|
| 'h5'
|
|
10
10
|
| 'h6'
|
|
11
|
-
| '
|
|
12
|
-
| '
|
|
13
|
-
| '
|
|
14
|
-
| '
|
|
15
|
-
| '
|
|
16
|
-
| '
|
|
17
|
-
| '
|
|
18
|
-
| '
|
|
11
|
+
| 'title-l'
|
|
12
|
+
| 'title-m'
|
|
13
|
+
| 'title-s'
|
|
14
|
+
| 'label-l'
|
|
15
|
+
| 'label-m'
|
|
16
|
+
| 'label-s'
|
|
17
|
+
| 'body-xl'
|
|
18
|
+
| 'body-l'
|
|
19
|
+
| 'body-m'
|
|
20
|
+
| 'body-s'
|
|
21
|
+
| 'body-xs'
|
|
19
22
|
| 'CTA';
|
|
20
23
|
|
|
24
|
+
export type HtmlTagVariant = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span' | 'p' | 'label';
|
|
25
|
+
|
|
21
26
|
export type NsTypographyProps = {
|
|
22
27
|
variant: Variants;
|
|
23
28
|
decoration?: 'underline' | 'none';
|
|
@@ -25,6 +30,8 @@ export type NsTypographyProps = {
|
|
|
25
30
|
weight?: 'bold' | 'normal' | 'light';
|
|
26
31
|
color?: FoundationTheme.PaletteColors;
|
|
27
32
|
component?: 'div' | 'span' | 'p';
|
|
33
|
+
as?: HtmlTagVariant;
|
|
28
34
|
className?: string;
|
|
29
35
|
colorOverride?: string;
|
|
36
|
+
renderHTMLNode?: boolean;
|
|
30
37
|
} & AdditionalProps;
|