@nuskin/foundation-ui-components 1.29.0-cx130-1216.2 → 1.29.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 +9 -2
- package/src/common/autocomplete/NsAutocomplete.spec.tsx +3 -3
- package/src/common/banner/NsBanner.spec.tsx +5 -5
- package/src/common/banner/NsBanner.tsx +18 -3
- package/src/common/banner/types.d.ts +2 -2
- package/src/common/card/NsAwardCard.tsx +7 -8
- package/src/common/card/NsHeroCardLevel1.tsx +6 -5
- package/src/common/card/NsHeroCardLevel2.tsx +6 -5
- package/src/common/card/NsLargeCard.tsx +6 -5
- package/src/common/card/NsMediumCard.tsx +7 -7
- package/src/common/card/NsPost.tsx +7 -5
- package/src/common/card/NsSmallFullCard.tsx +6 -5
- package/src/common/card/NsXLargeCard.tsx +12 -5
- package/src/common/card/specs/NsAwardCard.spec.tsx +2 -2
- package/src/common/card/specs/NsHeroCardLevel1.spec.tsx +3 -2
- package/src/common/card/specs/NsHeroCardLevel2.spec.tsx +2 -2
- package/src/common/card/specs/NsLargeCard.spec.tsx +3 -2
- package/src/common/card/specs/NsMediumCard.spec.tsx +3 -3
- package/src/common/card/specs/NsPost.spec.tsx +3 -3
- package/src/common/card/specs/NsSmallFullCard.spec.tsx +3 -3
- package/src/common/card/specs/NsXLargeCard.spec.tsx +3 -3
- package/src/common/card/stories/NsAwardCard.stories.tsx +4 -2
- package/src/common/card/stories/NsHeroCardLevel1.stories.tsx +4 -2
- package/src/common/card/stories/NsHeroCardLevel2.stories.tsx +4 -2
- package/src/common/card/stories/NsLargeCard.stories.tsx +4 -2
- package/src/common/card/stories/NsMediumCard.stories.tsx +4 -2
- package/src/common/card/stories/NsPost.stories.tsx +4 -2
- package/src/common/card/stories/NsSmallFullCard.stories.tsx +4 -2
- package/src/common/card/stories/NsXLargeCard.stories.tsx +5 -4
- package/src/common/image/NsImage.tsx +1 -1
- package/src/common/image/NsNextImage.tsx +1 -1
- package/src/common/image/index.ts +1 -1
- package/src/common/image/types.d.ts +30 -0
- package/src/common/toast/specs/Toast.spec.tsx +64 -56
- package/src/common/card/fixtures/ImageData1.ts +0 -38
- package/src/common/card/fixtures/ImageData2.ts +0 -38
- package/src/common/image/BynderMedia.spec.tsx +0 -42
- package/src/common/image/BynderMedia.tsx +0 -46
- package/src/common/image/bynder-util.spec.ts +0 -187
- package/src/common/image/bynder-util.ts +0 -98
- package/src/common/image/types.ts +0 -78
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuskin/foundation-ui-components",
|
|
3
|
-
"version": "1.29.0
|
|
3
|
+
"version": "1.29.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": {
|
|
@@ -46,12 +46,13 @@
|
|
|
46
46
|
"@mui/icons-material": "^5.14.16",
|
|
47
47
|
"@mui/material": "5.14.16",
|
|
48
48
|
"@mui/utils": "5.14.16",
|
|
49
|
-
"@nuskin/foundation-theme": "
|
|
49
|
+
"@nuskin/foundation-theme": "1.6.0",
|
|
50
50
|
"@types/react": "^18.2.0",
|
|
51
51
|
"@types/react-dom": "^18.2.0",
|
|
52
52
|
"cliui": "^8.0.1",
|
|
53
53
|
"framer-motion": "^10.16.4",
|
|
54
54
|
"next": "13.5.6",
|
|
55
|
+
"notistack": "^3.0.1",
|
|
55
56
|
"react": "^18.2.0",
|
|
56
57
|
"react-dom": "^18.2.0",
|
|
57
58
|
"react-material-ui-carousel": "^3.4.2",
|
|
@@ -99,6 +100,12 @@
|
|
|
99
100
|
"jest-environment-jsdom": "^29.7.0",
|
|
100
101
|
"storybook": "^7.5.1"
|
|
101
102
|
},
|
|
103
|
+
"peerDependencies": {
|
|
104
|
+
"react": "^18.2.0",
|
|
105
|
+
"react-dom": "^18.2.0",
|
|
106
|
+
"@nuskin/foundation-theme": "1.6.0",
|
|
107
|
+
"@mui/material": "5.14.16"
|
|
108
|
+
},
|
|
102
109
|
"files": [
|
|
103
110
|
"src/common"
|
|
104
111
|
],
|
|
@@ -56,7 +56,7 @@ describe('CustomAutocomplete', () => {
|
|
|
56
56
|
await userEvent.click(optionLi);
|
|
57
57
|
});
|
|
58
58
|
expect(onChangeMock).toHaveBeenCalled();
|
|
59
|
-
},
|
|
59
|
+
}, 160000);
|
|
60
60
|
|
|
61
61
|
it('5. should load more options when clicking load more button', async () => {
|
|
62
62
|
const seeMore = {
|
|
@@ -72,7 +72,7 @@ describe('CustomAutocomplete', () => {
|
|
|
72
72
|
await userEvent.click(loadMoreButton);
|
|
73
73
|
});
|
|
74
74
|
expect(seeMore.onSeeMore).toHaveBeenCalled();
|
|
75
|
-
},
|
|
75
|
+
}, 160000);
|
|
76
76
|
|
|
77
77
|
it('6. should clear options when clicking clear button', async () => {
|
|
78
78
|
const clear = {
|
|
@@ -87,5 +87,5 @@ describe('CustomAutocomplete', () => {
|
|
|
87
87
|
const clearButton = screen.getByText(clear.text);
|
|
88
88
|
await userEvent.click(clearButton);
|
|
89
89
|
});
|
|
90
|
-
},
|
|
90
|
+
}, 160000);
|
|
91
91
|
});
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render } from '@testing-library/react';
|
|
3
3
|
import { NsBanner } from '@/common/';
|
|
4
|
-
import { ImageData1 } from '../card/fixtures/ImageData1';
|
|
5
4
|
|
|
6
5
|
describe('Hero component', () => {
|
|
7
6
|
const childText = 'Welcome to My Website';
|
|
7
|
+
const imageURL = 'https://example.com/banner.jpg';
|
|
8
8
|
it('1. renders banner image and title', () => {
|
|
9
9
|
const { getByAltText, getByText } = render(
|
|
10
|
-
<NsBanner
|
|
10
|
+
<NsBanner imageUrl={imageURL} altText="Banner image">
|
|
11
11
|
<h1>{childText}</h1>
|
|
12
12
|
</NsBanner>
|
|
13
13
|
);
|
|
14
14
|
const childElement = getByText(childText);
|
|
15
|
-
const imageElement = getByAltText(
|
|
15
|
+
const imageElement = getByAltText('Banner image');
|
|
16
16
|
expect(childElement).toBeInTheDocument();
|
|
17
17
|
expect(imageElement).toBeInTheDocument();
|
|
18
18
|
});
|
|
19
19
|
it('2. renders banner image and title without altText', () => {
|
|
20
20
|
const { getByAltText } = render(
|
|
21
|
-
<NsBanner
|
|
21
|
+
<NsBanner imageUrl={imageURL}>
|
|
22
22
|
<h1>{childText}</h1>
|
|
23
23
|
</NsBanner>
|
|
24
24
|
);
|
|
25
|
-
const imageElement = getByAltText(
|
|
25
|
+
const imageElement = getByAltText('NsBanner');
|
|
26
26
|
expect(imageElement).toBeInTheDocument();
|
|
27
27
|
});
|
|
28
28
|
});
|
|
@@ -8,15 +8,30 @@ import React, { PropsWithChildren } from 'react';
|
|
|
8
8
|
|
|
9
9
|
import { NsBannerProps } from './types.d';
|
|
10
10
|
import { StyledBanner, StyledHeroText } from './NsBanner.styled';
|
|
11
|
-
import {
|
|
11
|
+
import { NsImage } from '../';
|
|
12
12
|
|
|
13
13
|
/* TODO: once we have storybook 7, we can try converting this NsImage to NsNextImage */
|
|
14
14
|
const NsBanner = (props: PropsWithChildren<NsBannerProps>) => {
|
|
15
|
-
const {
|
|
15
|
+
const {
|
|
16
|
+
children,
|
|
17
|
+
imageUrl,
|
|
18
|
+
altText,
|
|
19
|
+
alignment = 'center',
|
|
20
|
+
justify = 'start',
|
|
21
|
+
className = '',
|
|
22
|
+
additionalProps = {},
|
|
23
|
+
} = props;
|
|
16
24
|
|
|
17
25
|
return (
|
|
18
26
|
<StyledBanner className={className}>
|
|
19
|
-
<
|
|
27
|
+
<NsImage
|
|
28
|
+
src={imageUrl}
|
|
29
|
+
alt={altText || 'NsBanner'}
|
|
30
|
+
id="bgImage"
|
|
31
|
+
width={0}
|
|
32
|
+
height={0}
|
|
33
|
+
{...additionalProps}
|
|
34
|
+
/>
|
|
20
35
|
<StyledHeroText $alignment={alignment} $justify={justify}>
|
|
21
36
|
<div className="mx-14">{children}</div>
|
|
22
37
|
</StyledHeroText>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import { AdditionalProps } from '../common.types';
|
|
4
|
-
import { BynderImageDataType } from '../image/types';
|
|
5
4
|
|
|
6
5
|
export type AlignmentType = 'start' | 'center' | 'end';
|
|
7
6
|
|
|
8
7
|
export type NsBannerProps = {
|
|
9
8
|
children: React.ReactNode;
|
|
10
|
-
|
|
9
|
+
imageUrl: string;
|
|
10
|
+
altText?: string;
|
|
11
11
|
alignment?: AlignmentType;
|
|
12
12
|
justify?: AlignmentType;
|
|
13
13
|
className?: string;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import Box from '@mui/material/Box';
|
|
2
2
|
import { styled } from '@nuskin/foundation-theme';
|
|
3
|
-
|
|
4
|
-
import { NsTypography } from '../';
|
|
5
|
-
import { BynderMedia } from '../image/BynderMedia';
|
|
6
|
-
import { BynderImageDataType } from '../image/types';
|
|
3
|
+
import { NsImage, NsTypography } from '../';
|
|
7
4
|
|
|
8
5
|
type NsAwardCardProps = {
|
|
9
6
|
title: string;
|
|
10
7
|
awardName: string;
|
|
11
8
|
mediaOutlet: string;
|
|
12
|
-
|
|
9
|
+
backgroundImageUrl: string;
|
|
10
|
+
backgroundImageAlt: string;
|
|
13
11
|
className?: string;
|
|
14
12
|
};
|
|
15
13
|
|
|
@@ -47,14 +45,15 @@ export default function NsAwardCard({
|
|
|
47
45
|
title,
|
|
48
46
|
awardName,
|
|
49
47
|
mediaOutlet,
|
|
50
|
-
|
|
48
|
+
backgroundImageUrl,
|
|
49
|
+
backgroundImageAlt,
|
|
51
50
|
className,
|
|
52
51
|
}: NsAwardCardProps) {
|
|
53
52
|
return (
|
|
54
53
|
<CardContainer className={className} role="award-card" component="div" data-testid="award-card">
|
|
55
|
-
<
|
|
54
|
+
<NsImage alt={backgroundImageAlt} src={backgroundImageUrl} className="image" />
|
|
56
55
|
<div className="content">
|
|
57
|
-
<NsTypography weight=
|
|
56
|
+
<NsTypography weight='normal' className="title" variant="h5">
|
|
58
57
|
{title}
|
|
59
58
|
</NsTypography>
|
|
60
59
|
<NsTypography className="content-text" variant="body-l">
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import { NsImage } from '../';
|
|
1
2
|
import Box from '@mui/material/Box';
|
|
2
3
|
import { styled } from '@nuskin/foundation-theme';
|
|
3
4
|
import CardButton from './CardButton';
|
|
4
5
|
import { NsCardButton } from './types';
|
|
5
|
-
import { BynderMedia } from '../image/BynderMedia';
|
|
6
|
-
import { BynderImageDataType } from '../image/types';
|
|
7
6
|
|
|
8
7
|
type NsHeroCardLevel1Props = {
|
|
9
8
|
cardTitle: string;
|
|
10
9
|
cardDescription: string;
|
|
11
|
-
|
|
10
|
+
backgroundImageUrl: string;
|
|
11
|
+
backgroundImageAlt: string;
|
|
12
12
|
button?: NsCardButton;
|
|
13
13
|
className?: string;
|
|
14
14
|
imagePosition?: 'top' | 'bottom';
|
|
@@ -76,14 +76,15 @@ const CardContainer = styled((props: any) => <Box {...props} />)(({ imagePositio
|
|
|
76
76
|
export default function NsHeroCardLevel1({
|
|
77
77
|
cardTitle,
|
|
78
78
|
cardDescription,
|
|
79
|
-
|
|
79
|
+
backgroundImageUrl,
|
|
80
|
+
backgroundImageAlt,
|
|
80
81
|
button,
|
|
81
82
|
className,
|
|
82
83
|
imagePosition = 'top',
|
|
83
84
|
}: NsHeroCardLevel1Props) {
|
|
84
85
|
return (
|
|
85
86
|
<CardContainer className={className} data-testid="hero-card-level-1" imagePosition={imagePosition}>
|
|
86
|
-
<
|
|
87
|
+
<NsImage variant="fill" alt={backgroundImageAlt} src={backgroundImageUrl} className="bg-image" />
|
|
87
88
|
<div className="content">
|
|
88
89
|
<article className="body-title">{cardTitle}</article>
|
|
89
90
|
<article className="body-text">{cardDescription}</article>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import { NsImage } from '../';
|
|
1
2
|
import Box from '@mui/material/Box';
|
|
2
3
|
import { styled } from '@nuskin/foundation-theme';
|
|
3
4
|
import CardButton from './CardButton';
|
|
4
5
|
import { NsCardButton } from './types';
|
|
5
|
-
import { BynderMedia } from '../image/BynderMedia';
|
|
6
|
-
import { BynderImageDataType } from '../image/types';
|
|
7
6
|
|
|
8
7
|
type NsHeroCardLevel2Props = {
|
|
9
8
|
brandName: string;
|
|
10
9
|
cardTitle: string;
|
|
11
10
|
cardDescription: string;
|
|
12
|
-
|
|
11
|
+
backgroundImageUrl: string;
|
|
12
|
+
backgroundImageAlt: string;
|
|
13
13
|
button?: NsCardButton;
|
|
14
14
|
className?: string;
|
|
15
15
|
};
|
|
@@ -65,13 +65,14 @@ const NsHeroCardLevel2 = ({
|
|
|
65
65
|
brandName,
|
|
66
66
|
cardTitle,
|
|
67
67
|
cardDescription,
|
|
68
|
-
|
|
68
|
+
backgroundImageUrl,
|
|
69
|
+
backgroundImageAlt,
|
|
69
70
|
button,
|
|
70
71
|
className,
|
|
71
72
|
}: NsHeroCardLevel2Props) => {
|
|
72
73
|
return (
|
|
73
74
|
<CardContainer className={className} data-testid="hero-card-level-2">
|
|
74
|
-
<
|
|
75
|
+
<NsImage variant="fill" alt={backgroundImageAlt} src={backgroundImageUrl} className="bg-image" />
|
|
75
76
|
<div className="content">
|
|
76
77
|
<div className="brand-container">
|
|
77
78
|
<article>{brandName}</article>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import Box from '@mui/material/Box';
|
|
2
2
|
import { styled } from '@nuskin/foundation-theme';
|
|
3
|
+
import { NsImage } from '../';
|
|
3
4
|
import CardButton from './CardButton';
|
|
4
5
|
import { NsCardButton } from './types';
|
|
5
|
-
import { BynderMedia } from '../image/BynderMedia';
|
|
6
|
-
import { BynderImageDataType } from '../image/types';
|
|
7
6
|
|
|
8
7
|
type NsLargeCardProps = {
|
|
9
8
|
title: string;
|
|
10
9
|
subtitle?: string;
|
|
11
10
|
intro: string;
|
|
12
|
-
|
|
11
|
+
backgroundImageUrl: string;
|
|
12
|
+
backgroundImageAlt: string;
|
|
13
13
|
isHorizontal?: boolean;
|
|
14
14
|
button?: NsCardButton;
|
|
15
15
|
className?: string;
|
|
@@ -71,7 +71,8 @@ const CardContainer = styled((props: any) => <Box {...props} />)(({ isHorizontal
|
|
|
71
71
|
export default function NsLargeCard({
|
|
72
72
|
title,
|
|
73
73
|
subtitle,
|
|
74
|
-
|
|
74
|
+
backgroundImageUrl,
|
|
75
|
+
backgroundImageAlt,
|
|
75
76
|
intro,
|
|
76
77
|
isHorizontal,
|
|
77
78
|
button,
|
|
@@ -85,7 +86,7 @@ export default function NsLargeCard({
|
|
|
85
86
|
data-testid="large-card"
|
|
86
87
|
isHorizontal={isHorizontal}
|
|
87
88
|
>
|
|
88
|
-
<
|
|
89
|
+
<NsImage alt={backgroundImageAlt} src={backgroundImageUrl} className="bg-image" />
|
|
89
90
|
<div className="content">
|
|
90
91
|
<article className="subtitle">{subtitle}</article>
|
|
91
92
|
<article className="title">{title}</article>
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
+
import { NsCardButton } from './types';
|
|
1
2
|
import Box from '@mui/material/Box';
|
|
2
3
|
import { styled } from '@nuskin/foundation-theme';
|
|
3
4
|
|
|
4
|
-
import { NsTypography } from '../';
|
|
5
|
-
import { BynderMedia } from '../image/BynderMedia';
|
|
5
|
+
import { NsImage, NsTypography } from '../';
|
|
6
6
|
import CardButton from './CardButton';
|
|
7
|
-
import { NsCardButton } from './types';
|
|
8
|
-
import { BynderImageDataType } from '../image/types';
|
|
9
7
|
|
|
10
8
|
type NsMediumCardProps = {
|
|
11
9
|
title: string;
|
|
12
10
|
titleFontWeight?: 'bold' | 'normal' | 'light';
|
|
13
11
|
subtitle: string;
|
|
14
|
-
|
|
12
|
+
backgroundImageUrl: string;
|
|
13
|
+
backgroundImageAlt: string;
|
|
15
14
|
button?: NsCardButton;
|
|
16
15
|
className?: string;
|
|
17
16
|
fluid?: boolean;
|
|
@@ -72,7 +71,8 @@ export default function NsMediumCard({
|
|
|
72
71
|
title,
|
|
73
72
|
titleFontWeight,
|
|
74
73
|
subtitle,
|
|
75
|
-
|
|
74
|
+
backgroundImageUrl,
|
|
75
|
+
backgroundImageAlt,
|
|
76
76
|
button,
|
|
77
77
|
className,
|
|
78
78
|
fluid,
|
|
@@ -87,7 +87,7 @@ export default function NsMediumCard({
|
|
|
87
87
|
fluid={fluid || false}
|
|
88
88
|
variant={button?.buttonVariant ?? ''}
|
|
89
89
|
>
|
|
90
|
-
<
|
|
90
|
+
<NsImage alt={backgroundImageAlt} src={backgroundImageUrl} className="image" />
|
|
91
91
|
<div className="content">
|
|
92
92
|
<NsTypography variant="h5" color="primary" className="title" weight={titleFontWeight}>
|
|
93
93
|
{title}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import Box from '@mui/material/Box';
|
|
2
|
+
import { NsImage } from '../';
|
|
2
3
|
import { styled } from '@nuskin/foundation-theme';
|
|
3
|
-
import { BynderMedia } from '../image/BynderMedia';
|
|
4
|
-
import { BynderImageDataType } from '../image/types';
|
|
5
4
|
|
|
6
5
|
type NsPostProps = {
|
|
7
6
|
text: string;
|
|
8
7
|
body: string;
|
|
9
|
-
|
|
8
|
+
backgroundImageUrl: string;
|
|
9
|
+
backgroundImageAlt: string;
|
|
10
10
|
className?: string;
|
|
11
11
|
};
|
|
12
12
|
|
|
@@ -56,10 +56,12 @@ const CardContainer = styled(Box)(() => {
|
|
|
56
56
|
};
|
|
57
57
|
});
|
|
58
58
|
|
|
59
|
-
const NsPost = ({ text, body,
|
|
59
|
+
const NsPost = ({ text, body, backgroundImageUrl, backgroundImageAlt, className }: NsPostProps) => {
|
|
60
60
|
return (
|
|
61
61
|
<CardContainer className={className} data-testid="post-card">
|
|
62
|
-
<
|
|
62
|
+
<div className="image">
|
|
63
|
+
<NsImage height={'100%'} width={'auto'} alt={backgroundImageAlt} src={backgroundImageUrl} />
|
|
64
|
+
</div>
|
|
63
65
|
<div className="content">
|
|
64
66
|
<article className="body-title">{text}</article>
|
|
65
67
|
<article className="body-text">{body}</article>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import Box from '@mui/material/Box';
|
|
2
2
|
import { styled } from '@nuskin/foundation-theme';
|
|
3
|
+
import { NsImage } from '../';
|
|
3
4
|
import { NsCardButton } from './types';
|
|
4
5
|
import CardButton from './CardButton';
|
|
5
|
-
import { BynderMedia } from '../image/BynderMedia';
|
|
6
|
-
import { BynderImageDataType } from '../image/types';
|
|
7
6
|
|
|
8
7
|
type NsSmallFullCardProps = {
|
|
9
8
|
title: string;
|
|
10
9
|
subtitle: string;
|
|
11
|
-
|
|
10
|
+
backgroundImageUrl: string;
|
|
11
|
+
backgroundImageAlt: string;
|
|
12
12
|
button?: NsCardButton;
|
|
13
13
|
className?: string;
|
|
14
14
|
};
|
|
@@ -66,13 +66,14 @@ const CardContainer = styled(Box)(() => {
|
|
|
66
66
|
export default function NsSmallFullCard({
|
|
67
67
|
title,
|
|
68
68
|
subtitle,
|
|
69
|
-
|
|
69
|
+
backgroundImageUrl,
|
|
70
|
+
backgroundImageAlt,
|
|
70
71
|
button,
|
|
71
72
|
className,
|
|
72
73
|
}: NsSmallFullCardProps) {
|
|
73
74
|
return (
|
|
74
75
|
<CardContainer className={className} role="small-full-card" component="div" data-testid="small-full-card">
|
|
75
|
-
<
|
|
76
|
+
<NsImage alt={backgroundImageAlt} src={backgroundImageUrl} className="image" />
|
|
76
77
|
<div className="gradientOverlay"></div>
|
|
77
78
|
<div className="content">
|
|
78
79
|
<article className="subtitle">{subtitle}</article>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import Box from '@mui/material/Box';
|
|
2
2
|
import { styled } from '@nuskin/foundation-theme';
|
|
3
|
+
import { NsImage } from '../';
|
|
3
4
|
import CardButton from './CardButton';
|
|
4
5
|
import { NsCardButton } from './types';
|
|
5
|
-
import { BynderMedia } from '../image/BynderMedia';
|
|
6
|
-
import { BynderImageDataType } from '../image/types';
|
|
7
6
|
|
|
8
7
|
type NsXLargeCardProps = {
|
|
9
8
|
title: string;
|
|
10
9
|
subtitle: string;
|
|
11
|
-
|
|
10
|
+
backgroundImageUrl: string;
|
|
11
|
+
backgroundImageAlt: string;
|
|
12
12
|
button?: NsCardButton;
|
|
13
13
|
className?: string;
|
|
14
14
|
};
|
|
@@ -59,10 +59,17 @@ const CardContainer = styled(Box)(() => {
|
|
|
59
59
|
};
|
|
60
60
|
});
|
|
61
61
|
|
|
62
|
-
export default function NsXLargeCard({
|
|
62
|
+
export default function NsXLargeCard({
|
|
63
|
+
title,
|
|
64
|
+
subtitle,
|
|
65
|
+
backgroundImageUrl,
|
|
66
|
+
backgroundImageAlt,
|
|
67
|
+
button,
|
|
68
|
+
className,
|
|
69
|
+
}: NsXLargeCardProps) {
|
|
63
70
|
return (
|
|
64
71
|
<CardContainer className={className} role="x-large-card" component="div" data-testid="x-large-card">
|
|
65
|
-
<
|
|
72
|
+
<NsImage alt={backgroundImageAlt} src={backgroundImageUrl} className="image" />
|
|
66
73
|
<div className="gradientOverlay"></div>
|
|
67
74
|
<div className="content">
|
|
68
75
|
<article className="subtitle">{subtitle}</article>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import NsAwardCard from '../NsAwardCard';
|
|
4
|
-
import { ImageData1 } from '../fixtures/ImageData1';
|
|
5
4
|
|
|
6
5
|
describe('NsHeroCardLevel1 component', () => {
|
|
7
6
|
const props = {
|
|
8
7
|
title: 'AgeLoc LumiSpa iO',
|
|
9
8
|
awardName: '2023 Bronze Winner',
|
|
10
9
|
mediaOutlet: 'Edison Awards',
|
|
11
|
-
|
|
10
|
+
backgroundImageUrl: 'https://media.nuskin.com/m/2ec571a87dc9680c/Small-Edison-Bronze-Logo-Homepage.jpg',
|
|
11
|
+
backgroundImageAlt: 'Edison Bronze Logo',
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
it('1. renders with correct content and styles', () => {
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import NsHeroCardLevel1 from '../NsHeroCardLevel1';
|
|
4
|
-
import { ImageData1 } from '../fixtures/ImageData1';
|
|
5
4
|
|
|
6
5
|
describe('NsHeroCardLevel1 component', () => {
|
|
7
6
|
const props = {
|
|
8
7
|
cardTitle: 'A skin ready for winter',
|
|
9
8
|
cardDescription:
|
|
10
9
|
'We have brought these discoveries to life through our powerful skin care products and supplements.',
|
|
11
|
-
|
|
10
|
+
backgroundImageUrl:
|
|
11
|
+
'https://media.nuskin.com/m/9734240cc191163/webimage-lash-brow-serum-carousel-image-launch.png',
|
|
12
|
+
backgroundImageAlt: 'lash brow serum carousel',
|
|
12
13
|
button: {
|
|
13
14
|
showButton: true,
|
|
14
15
|
buttonText: 'SHOP NOW',
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import { NsHeroCardLevel2 } from '../';
|
|
4
|
-
import { ImageData1 } from '../fixtures/ImageData1';
|
|
5
4
|
|
|
6
5
|
describe('NsHeroCardLevel2 component', () => {
|
|
7
6
|
const props = {
|
|
8
7
|
cardTitle: 'Current shop deals',
|
|
9
8
|
cardDescription: 'Lumispa, sunscreen and more',
|
|
10
9
|
brandName: 'Beauty focus™',
|
|
11
|
-
|
|
10
|
+
backgroundImageUrl: 'https://media.nuskin.com/m/5f1c423bb57589f0/webimage-autumn-sale-carousel.png',
|
|
11
|
+
backgroundImageAlt: 'lash brow serum carousel',
|
|
12
12
|
button: {
|
|
13
13
|
showButton: true,
|
|
14
14
|
buttonText: 'Discover more',
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { render, screen } from '@testing-library/react';
|
|
2
2
|
import { NsLargeCard } from '../';
|
|
3
|
-
import { ImageData1 } from '../fixtures/ImageData1';
|
|
4
3
|
|
|
5
4
|
describe('NsLargeCard component', () => {
|
|
6
5
|
const props = {
|
|
@@ -15,7 +14,9 @@ describe('NsLargeCard component', () => {
|
|
|
15
14
|
buttonColor: 'secondary' as 'secondary',
|
|
16
15
|
url: 'https://www.forceforgood.org/',
|
|
17
16
|
},
|
|
18
|
-
|
|
17
|
+
backgroundImageUrl:
|
|
18
|
+
'https://media.nuskin.com/m/95f9cf4143e3882/Small-About_Us-Personal-Care-Products-Image.jpg',
|
|
19
|
+
backgroundImageAlt: 'Facial Moisturizers',
|
|
19
20
|
};
|
|
20
21
|
|
|
21
22
|
it('1. renders with correct content and styles', () => {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import NsMediumCard from '../NsMediumCard';
|
|
4
|
-
import { ImageData1 } from '../fixtures/ImageData1';
|
|
5
4
|
|
|
6
5
|
describe('NsMediumCard component', () => {
|
|
7
6
|
const props = {
|
|
@@ -16,7 +15,8 @@ describe('NsMediumCard component', () => {
|
|
|
16
15
|
buttonColor: 'secondary' as 'secondary',
|
|
17
16
|
url: '#',
|
|
18
17
|
},
|
|
19
|
-
|
|
18
|
+
backgroundImageUrl: 'https://media.nuskin.com/m/3353b9c05cb83860/Small-category-facial_moisturizers.jpg',
|
|
19
|
+
backgroundImageAlt: 'Lumi Spa',
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
it('1. renders with correct content and styles', () => {
|
|
@@ -33,7 +33,7 @@ describe('NsMediumCard component', () => {
|
|
|
33
33
|
);
|
|
34
34
|
expect(subtitleElement).toBeInTheDocument();
|
|
35
35
|
|
|
36
|
-
const imageElement = screen.getByAltText(
|
|
36
|
+
const imageElement = screen.getByAltText('Lumi Spa');
|
|
37
37
|
expect(imageElement).toBeInTheDocument();
|
|
38
38
|
|
|
39
39
|
const button = screen.queryByText('SEE WHAT WE’RE DOING');
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import NsPost from '../NsPost';
|
|
4
|
-
import { ImageData1 } from '../fixtures/ImageData1';
|
|
5
4
|
|
|
6
5
|
describe('NsPost component', () => {
|
|
7
6
|
const props = {
|
|
8
7
|
text: '38 New Beauty Products Our Editors Are Loving',
|
|
9
8
|
body: 'SPA & BEAUTY TODAY',
|
|
10
|
-
|
|
9
|
+
backgroundImageUrl: 'https://media.nuskin.com/m/780f8d84bcb9d5ed/Small-Essence_News.jpg',
|
|
10
|
+
backgroundImageAlt: 'small essence news',
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
it('1. renders with correct content and styles', () => {
|
|
@@ -22,7 +22,7 @@ describe('NsPost component', () => {
|
|
|
22
22
|
const bodyElement = screen.getByText('SPA & BEAUTY TODAY');
|
|
23
23
|
expect(bodyElement).toBeInTheDocument();
|
|
24
24
|
|
|
25
|
-
const imageElement = screen.getByAltText(
|
|
25
|
+
const imageElement = screen.getByAltText('small essence news');
|
|
26
26
|
expect(imageElement).toBeInTheDocument();
|
|
27
27
|
});
|
|
28
28
|
});
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import NsSmallFullCard from '../NsSmallFullCard';
|
|
4
|
-
import { ImageData1 } from '../fixtures/ImageData1';
|
|
5
4
|
|
|
6
5
|
describe('NsSmallFullCard component', () => {
|
|
7
6
|
const props = {
|
|
8
7
|
title: 'Title',
|
|
9
8
|
subtitle: 'Subtitle',
|
|
10
|
-
|
|
9
|
+
backgroundImageUrl: 'https://media.nuskin.com/m/4f5b0aee8fe3ff90/Small-category-makeup.jpg',
|
|
10
|
+
backgroundImageAlt: 'Facial Moisturizers',
|
|
11
11
|
button: {
|
|
12
12
|
showButton: true,
|
|
13
13
|
buttonText: 'Placeholder',
|
|
@@ -29,7 +29,7 @@ describe('NsSmallFullCard component', () => {
|
|
|
29
29
|
const subtitleElement = screen.getByText('Subtitle');
|
|
30
30
|
expect(subtitleElement).toBeInTheDocument();
|
|
31
31
|
|
|
32
|
-
const imageElement = screen.getByAltText(
|
|
32
|
+
const imageElement = screen.getByAltText('Facial Moisturizers');
|
|
33
33
|
expect(imageElement).toBeInTheDocument();
|
|
34
34
|
|
|
35
35
|
const linkElement = screen.getByText('Placeholder');
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import NsXLargeCard from '../NsXLargeCard';
|
|
4
|
-
import { ImageData1 } from '../fixtures/ImageData1';
|
|
5
4
|
|
|
6
5
|
describe('NsXLargeCard component', () => {
|
|
7
6
|
const props = {
|
|
8
7
|
title: 'Title',
|
|
9
8
|
subtitle: 'Subtitle',
|
|
10
|
-
|
|
9
|
+
backgroundImageUrl: 'https://media.nuskin.com/m/4f5b0aee8fe3ff90/Small-category-makeup.jpg',
|
|
10
|
+
backgroundImageAlt: 'Facial Moisturizers',
|
|
11
11
|
button: {
|
|
12
12
|
showButton: true,
|
|
13
13
|
buttonText: 'Discover more',
|
|
@@ -29,7 +29,7 @@ describe('NsXLargeCard component', () => {
|
|
|
29
29
|
const titleElement = screen.getByText('Title');
|
|
30
30
|
expect(titleElement).toBeInTheDocument();
|
|
31
31
|
|
|
32
|
-
const imageElement = screen.getByAltText(
|
|
32
|
+
const imageElement = screen.getByAltText('Facial Moisturizers');
|
|
33
33
|
expect(imageElement).toBeInTheDocument();
|
|
34
34
|
|
|
35
35
|
const linkElement = screen.getByText('Discover more');
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { StoryObj, Meta } from '@storybook/react';
|
|
2
2
|
import { NsAwardCard } from '../';
|
|
3
|
-
import { ImageData1 } from '../fixtures/ImageData1';
|
|
4
3
|
|
|
5
4
|
type ComponentType = typeof NsAwardCard;
|
|
6
5
|
type Story = StoryObj<ComponentType>;
|
|
@@ -11,11 +10,14 @@ export default {
|
|
|
11
10
|
title: 'Components/Containers/Card/NsAwardCard',
|
|
12
11
|
} as MetaStory;
|
|
13
12
|
|
|
13
|
+
const host = 'https://media.nuskin.com';
|
|
14
|
+
|
|
14
15
|
export const Default: Story = {
|
|
15
16
|
args: {
|
|
16
17
|
title: 'AgeLoc LumiSpa iO',
|
|
17
18
|
awardName: '2023 Bronze Winner',
|
|
18
19
|
mediaOutlet: 'Edison Awards',
|
|
19
|
-
|
|
20
|
+
backgroundImageUrl: `${host}/m/2ec571a87dc9680c/Small-Edison-Bronze-Logo-Homepage.jpg`,
|
|
21
|
+
backgroundImageAlt: 'Edison Bronze Logo',
|
|
20
22
|
},
|
|
21
23
|
};
|