@nuskin/foundation-ui-components 1.26.1 → 1.28.0-cx130-1216.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 +2 -1
- package/src/common/autocomplete/NsAutocomplete.spec.tsx +3 -3
- package/src/common/autocomplete/NsAutocomplete.tsx +4 -4
- package/src/common/autocomplete/stories/NsAutocomplete.stories.tsx +1 -0
- package/src/common/banner/NsBanner.spec.tsx +5 -5
- package/src/common/banner/NsBanner.tsx +3 -18
- package/src/common/banner/types.d.ts +2 -2
- package/src/common/card/NsAwardCard.tsx +8 -7
- package/src/common/card/NsHeroCardLevel1.tsx +5 -6
- package/src/common/card/NsHeroCardLevel2.tsx +5 -6
- package/src/common/card/NsLargeCard.tsx +5 -6
- package/src/common/card/NsMediumCard.tsx +7 -7
- package/src/common/card/NsPost.tsx +5 -7
- package/src/common/card/NsSmallFullCard.tsx +5 -6
- package/src/common/card/NsXLargeCard.tsx +5 -12
- package/src/common/card/fixtures/ImageData1.ts +38 -0
- package/src/common/card/fixtures/ImageData2.ts +38 -0
- package/src/common/card/specs/NsAwardCard.spec.tsx +2 -2
- package/src/common/card/specs/NsHeroCardLevel1.spec.tsx +2 -3
- package/src/common/card/specs/NsHeroCardLevel2.spec.tsx +2 -2
- package/src/common/card/specs/NsLargeCard.spec.tsx +2 -3
- 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 +2 -4
- package/src/common/card/stories/NsHeroCardLevel1.stories.tsx +2 -4
- package/src/common/card/stories/NsHeroCardLevel2.stories.tsx +2 -4
- package/src/common/card/stories/NsLargeCard.stories.tsx +2 -4
- package/src/common/card/stories/NsMediumCard.stories.tsx +2 -4
- package/src/common/card/stories/NsPost.stories.tsx +2 -4
- package/src/common/card/stories/NsSmallFullCard.stories.tsx +2 -4
- package/src/common/card/stories/NsXLargeCard.stories.tsx +4 -5
- package/src/common/image/BynderMedia.spec.tsx +42 -0
- package/src/common/image/BynderMedia.tsx +46 -0
- package/src/common/image/NsImage.tsx +1 -1
- package/src/common/image/NsNextImage.tsx +1 -1
- package/src/common/image/bynder-util.spec.ts +187 -0
- package/src/common/image/bynder-util.ts +98 -0
- package/src/common/image/index.ts +1 -1
- package/src/common/image/types.ts +78 -0
- package/src/common/toast/specs/Toast.spec.tsx +56 -64
- package/src/common/image/types.d.ts +0 -30
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuskin/foundation-ui-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.28.0-cx130-1216.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": {
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"@mui/material": "5.14.16",
|
|
48
48
|
"@mui/utils": "^5.14.16",
|
|
49
49
|
"@next/font": "13.5.6",
|
|
50
|
+
"@nuskin/foundation-core-app": "^1.6.0",
|
|
50
51
|
"@nuskin/foundation-theme": "^1.5.0",
|
|
51
52
|
"@types/react": "^18.2.34",
|
|
52
53
|
"@types/react-dom": "^18.2.14",
|
|
@@ -56,7 +56,7 @@ describe('CustomAutocomplete', () => {
|
|
|
56
56
|
await userEvent.click(optionLi);
|
|
57
57
|
});
|
|
58
58
|
expect(onChangeMock).toHaveBeenCalled();
|
|
59
|
-
},
|
|
59
|
+
}, 90000000);
|
|
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
|
+
}, 9000000);
|
|
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
|
+
}, 90000000);
|
|
91
91
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Autocomplete, AutocompleteRenderInputParams } from '@mui/material';
|
|
1
|
+
import { Autocomplete, AutocompleteRenderInputParams, Popper } from '@mui/material';
|
|
2
2
|
import React, { PropsWithChildren, useEffect, useRef, useState } from 'react';
|
|
3
3
|
|
|
4
4
|
import { LineLoader } from './helper/LineLoader';
|
|
5
5
|
import { RecentClearAll } from './helper/RecentClearAll';
|
|
6
6
|
import { renderGroupBy, renderGroupName, renderOptionLabel } from './helper/renderGroupName';
|
|
7
7
|
import { SeeMoreButton } from './helper/SeeMoreButton';
|
|
8
|
-
import { StyledTextField } from './NsAutocomplete.styled';
|
|
8
|
+
import { StyledPopper, StyledTextField } from './NsAutocomplete.styled';
|
|
9
9
|
import { ComponentBoxProps, NsAutocompleteProps, OptionsProps } from './types.d';
|
|
10
10
|
|
|
11
11
|
const noop = () => {};
|
|
@@ -104,8 +104,8 @@ const NsAutocomplete = ({
|
|
|
104
104
|
getOptionLabel={renderOptionLabel}
|
|
105
105
|
renderOption={renderOption as any}
|
|
106
106
|
renderInput={renderInput}
|
|
107
|
-
|
|
108
|
-
ListboxComponent={renderListBoxComponent
|
|
107
|
+
PopperComponent={fullWidth ? StyledPopper : Popper}
|
|
108
|
+
ListboxComponent={renderListBoxComponent}
|
|
109
109
|
renderGroup={renderGroupName}
|
|
110
110
|
onChange={onChange}
|
|
111
111
|
onInputChange={onInputChange}
|
|
@@ -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';
|
|
4
5
|
|
|
5
6
|
describe('Hero component', () => {
|
|
6
7
|
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 image={ImageData1}>
|
|
11
11
|
<h1>{childText}</h1>
|
|
12
12
|
</NsBanner>
|
|
13
13
|
);
|
|
14
14
|
const childElement = getByText(childText);
|
|
15
|
-
const imageElement = getByAltText(
|
|
15
|
+
const imageElement = getByAltText(ImageData1.selected?.altText || '');
|
|
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 image={ImageData1}>
|
|
22
22
|
<h1>{childText}</h1>
|
|
23
23
|
</NsBanner>
|
|
24
24
|
);
|
|
25
|
-
const imageElement = getByAltText('
|
|
25
|
+
const imageElement = getByAltText(ImageData1.selected?.altText || '');
|
|
26
26
|
expect(imageElement).toBeInTheDocument();
|
|
27
27
|
});
|
|
28
28
|
});
|
|
@@ -8,30 +8,15 @@ 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 { BynderMedia } from '../image/BynderMedia';
|
|
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 {
|
|
16
|
-
children,
|
|
17
|
-
imageUrl,
|
|
18
|
-
altText,
|
|
19
|
-
alignment = 'center',
|
|
20
|
-
justify = 'start',
|
|
21
|
-
className = '',
|
|
22
|
-
additionalProps = {},
|
|
23
|
-
} = props;
|
|
15
|
+
const { children, image, alignment = 'center', justify = 'start', className = '', additionalProps = {} } = props;
|
|
24
16
|
|
|
25
17
|
return (
|
|
26
18
|
<StyledBanner className={className}>
|
|
27
|
-
<
|
|
28
|
-
src={imageUrl}
|
|
29
|
-
alt={altText || 'NsBanner'}
|
|
30
|
-
id="bgImage"
|
|
31
|
-
width={0}
|
|
32
|
-
height={0}
|
|
33
|
-
{...additionalProps}
|
|
34
|
-
/>
|
|
19
|
+
<BynderMedia className="image" imageDetail={image} {...additionalProps} />
|
|
35
20
|
<StyledHeroText $alignment={alignment} $justify={justify}>
|
|
36
21
|
<div className="mx-14">{children}</div>
|
|
37
22
|
</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';
|
|
4
5
|
|
|
5
6
|
export type AlignmentType = 'start' | 'center' | 'end';
|
|
6
7
|
|
|
7
8
|
export type NsBannerProps = {
|
|
8
9
|
children: React.ReactNode;
|
|
9
|
-
|
|
10
|
-
altText?: string;
|
|
10
|
+
image: BynderImageDataType;
|
|
11
11
|
alignment?: AlignmentType;
|
|
12
12
|
justify?: AlignmentType;
|
|
13
13
|
className?: string;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import Box from '@mui/material/Box';
|
|
2
2
|
import { styled } from '@nuskin/foundation-theme';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
import { NsTypography } from '../';
|
|
5
|
+
import { BynderMedia } from '../image/BynderMedia';
|
|
6
|
+
import { BynderImageDataType } from '../image/types';
|
|
4
7
|
|
|
5
8
|
type NsAwardCardProps = {
|
|
6
9
|
title: string;
|
|
7
10
|
awardName: string;
|
|
8
11
|
mediaOutlet: string;
|
|
9
|
-
|
|
10
|
-
backgroundImageAlt: string;
|
|
12
|
+
backgroundImageDetail: BynderImageDataType;
|
|
11
13
|
className?: string;
|
|
12
14
|
};
|
|
13
15
|
|
|
@@ -45,15 +47,14 @@ export default function NsAwardCard({
|
|
|
45
47
|
title,
|
|
46
48
|
awardName,
|
|
47
49
|
mediaOutlet,
|
|
48
|
-
|
|
49
|
-
backgroundImageAlt,
|
|
50
|
+
backgroundImageDetail,
|
|
50
51
|
className,
|
|
51
52
|
}: NsAwardCardProps) {
|
|
52
53
|
return (
|
|
53
54
|
<CardContainer className={className} role="award-card" component="div" data-testid="award-card">
|
|
54
|
-
<
|
|
55
|
+
<BynderMedia className="image" imageDetail={backgroundImageDetail} />
|
|
55
56
|
<div className="content">
|
|
56
|
-
<NsTypography weight=
|
|
57
|
+
<NsTypography weight="normal" className="title" variant="h5">
|
|
57
58
|
{title}
|
|
58
59
|
</NsTypography>
|
|
59
60
|
<NsTypography className="content-text" variant="body-l">
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { NsImage } from '../';
|
|
2
1
|
import Box from '@mui/material/Box';
|
|
3
2
|
import { styled } from '@nuskin/foundation-theme';
|
|
4
3
|
import CardButton from './CardButton';
|
|
5
4
|
import { NsCardButton } from './types';
|
|
5
|
+
import { BynderMedia } from '../image/BynderMedia';
|
|
6
|
+
import { BynderImageDataType } from '../image/types';
|
|
6
7
|
|
|
7
8
|
type NsHeroCardLevel1Props = {
|
|
8
9
|
cardTitle: string;
|
|
9
10
|
cardDescription: string;
|
|
10
|
-
|
|
11
|
-
backgroundImageAlt: string;
|
|
11
|
+
backgroundImageDetail: BynderImageDataType;
|
|
12
12
|
button?: NsCardButton;
|
|
13
13
|
className?: string;
|
|
14
14
|
imagePosition?: 'top' | 'bottom';
|
|
@@ -76,15 +76,14 @@ const CardContainer = styled((props: any) => <Box {...props} />)(({ imagePositio
|
|
|
76
76
|
export default function NsHeroCardLevel1({
|
|
77
77
|
cardTitle,
|
|
78
78
|
cardDescription,
|
|
79
|
-
|
|
80
|
-
backgroundImageAlt,
|
|
79
|
+
backgroundImageDetail,
|
|
81
80
|
button,
|
|
82
81
|
className,
|
|
83
82
|
imagePosition = 'top',
|
|
84
83
|
}: NsHeroCardLevel1Props) {
|
|
85
84
|
return (
|
|
86
85
|
<CardContainer className={className} data-testid="hero-card-level-1" imagePosition={imagePosition}>
|
|
87
|
-
<
|
|
86
|
+
<BynderMedia className="bg-image" imageDetail={backgroundImageDetail} />
|
|
88
87
|
<div className="content">
|
|
89
88
|
<article className="body-title">{cardTitle}</article>
|
|
90
89
|
<article className="body-text">{cardDescription}</article>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { NsImage } from '../';
|
|
2
1
|
import Box from '@mui/material/Box';
|
|
3
2
|
import { styled } from '@nuskin/foundation-theme';
|
|
4
3
|
import CardButton from './CardButton';
|
|
5
4
|
import { NsCardButton } from './types';
|
|
5
|
+
import { BynderMedia } from '../image/BynderMedia';
|
|
6
|
+
import { BynderImageDataType } from '../image/types';
|
|
6
7
|
|
|
7
8
|
type NsHeroCardLevel2Props = {
|
|
8
9
|
brandName: string;
|
|
9
10
|
cardTitle: string;
|
|
10
11
|
cardDescription: string;
|
|
11
|
-
|
|
12
|
-
backgroundImageAlt: string;
|
|
12
|
+
backgroundImageDetail: BynderImageDataType;
|
|
13
13
|
button?: NsCardButton;
|
|
14
14
|
className?: string;
|
|
15
15
|
};
|
|
@@ -65,14 +65,13 @@ const NsHeroCardLevel2 = ({
|
|
|
65
65
|
brandName,
|
|
66
66
|
cardTitle,
|
|
67
67
|
cardDescription,
|
|
68
|
-
|
|
69
|
-
backgroundImageAlt,
|
|
68
|
+
backgroundImageDetail,
|
|
70
69
|
button,
|
|
71
70
|
className,
|
|
72
71
|
}: NsHeroCardLevel2Props) => {
|
|
73
72
|
return (
|
|
74
73
|
<CardContainer className={className} data-testid="hero-card-level-2">
|
|
75
|
-
<
|
|
74
|
+
<BynderMedia className="bg-image" imageDetail={backgroundImageDetail} />
|
|
76
75
|
<div className="content">
|
|
77
76
|
<div className="brand-container">
|
|
78
77
|
<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 '../';
|
|
4
3
|
import CardButton from './CardButton';
|
|
5
4
|
import { NsCardButton } from './types';
|
|
5
|
+
import { BynderMedia } from '../image/BynderMedia';
|
|
6
|
+
import { BynderImageDataType } from '../image/types';
|
|
6
7
|
|
|
7
8
|
type NsLargeCardProps = {
|
|
8
9
|
title: string;
|
|
9
10
|
subtitle?: string;
|
|
10
11
|
intro: string;
|
|
11
|
-
|
|
12
|
-
backgroundImageAlt: string;
|
|
12
|
+
backgroundImageDetail: BynderImageDataType;
|
|
13
13
|
isHorizontal?: boolean;
|
|
14
14
|
button?: NsCardButton;
|
|
15
15
|
className?: string;
|
|
@@ -71,8 +71,7 @@ const CardContainer = styled((props: any) => <Box {...props} />)(({ isHorizontal
|
|
|
71
71
|
export default function NsLargeCard({
|
|
72
72
|
title,
|
|
73
73
|
subtitle,
|
|
74
|
-
|
|
75
|
-
backgroundImageAlt,
|
|
74
|
+
backgroundImageDetail,
|
|
76
75
|
intro,
|
|
77
76
|
isHorizontal,
|
|
78
77
|
button,
|
|
@@ -86,7 +85,7 @@ export default function NsLargeCard({
|
|
|
86
85
|
data-testid="large-card"
|
|
87
86
|
isHorizontal={isHorizontal}
|
|
88
87
|
>
|
|
89
|
-
<
|
|
88
|
+
<BynderMedia className="bg-image" imageDetail={backgroundImageDetail} />
|
|
90
89
|
<div className="content">
|
|
91
90
|
<article className="subtitle">{subtitle}</article>
|
|
92
91
|
<article className="title">{title}</article>
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { NsCardButton } from './types';
|
|
2
1
|
import Box from '@mui/material/Box';
|
|
3
2
|
import { styled } from '@nuskin/foundation-theme';
|
|
4
3
|
|
|
5
|
-
import {
|
|
4
|
+
import { NsTypography } from '../';
|
|
5
|
+
import { BynderMedia } from '../image/BynderMedia';
|
|
6
6
|
import CardButton from './CardButton';
|
|
7
|
+
import { NsCardButton } from './types';
|
|
8
|
+
import { BynderImageDataType } from '../image/types';
|
|
7
9
|
|
|
8
10
|
type NsMediumCardProps = {
|
|
9
11
|
title: string;
|
|
10
12
|
titleFontWeight?: 'bold' | 'normal' | 'light';
|
|
11
13
|
subtitle: string;
|
|
12
|
-
|
|
13
|
-
backgroundImageAlt: string;
|
|
14
|
+
backgroundImageDetail: BynderImageDataType;
|
|
14
15
|
button?: NsCardButton;
|
|
15
16
|
className?: string;
|
|
16
17
|
fluid?: boolean;
|
|
@@ -71,8 +72,7 @@ export default function NsMediumCard({
|
|
|
71
72
|
title,
|
|
72
73
|
titleFontWeight,
|
|
73
74
|
subtitle,
|
|
74
|
-
|
|
75
|
-
backgroundImageAlt,
|
|
75
|
+
backgroundImageDetail,
|
|
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
|
+
<BynderMedia className="image" imageDetail={backgroundImageDetail} />
|
|
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 '../';
|
|
3
2
|
import { styled } from '@nuskin/foundation-theme';
|
|
3
|
+
import { BynderMedia } from '../image/BynderMedia';
|
|
4
|
+
import { BynderImageDataType } from '../image/types';
|
|
4
5
|
|
|
5
6
|
type NsPostProps = {
|
|
6
7
|
text: string;
|
|
7
8
|
body: string;
|
|
8
|
-
|
|
9
|
-
backgroundImageAlt: string;
|
|
9
|
+
backgroundImageDetail: BynderImageDataType;
|
|
10
10
|
className?: string;
|
|
11
11
|
};
|
|
12
12
|
|
|
@@ -56,12 +56,10 @@ const CardContainer = styled(Box)(() => {
|
|
|
56
56
|
};
|
|
57
57
|
});
|
|
58
58
|
|
|
59
|
-
const NsPost = ({ text, body,
|
|
59
|
+
const NsPost = ({ text, body, backgroundImageDetail, className }: NsPostProps) => {
|
|
60
60
|
return (
|
|
61
61
|
<CardContainer className={className} data-testid="post-card">
|
|
62
|
-
<
|
|
63
|
-
<NsImage height={'100%'} width={'auto'} alt={backgroundImageAlt} src={backgroundImageUrl} />
|
|
64
|
-
</div>
|
|
62
|
+
<BynderMedia className="image" imageDetail={backgroundImageDetail} />
|
|
65
63
|
<div className="content">
|
|
66
64
|
<article className="body-title">{text}</article>
|
|
67
65
|
<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 '../';
|
|
4
3
|
import { NsCardButton } from './types';
|
|
5
4
|
import CardButton from './CardButton';
|
|
5
|
+
import { BynderMedia } from '../image/BynderMedia';
|
|
6
|
+
import { BynderImageDataType } from '../image/types';
|
|
6
7
|
|
|
7
8
|
type NsSmallFullCardProps = {
|
|
8
9
|
title: string;
|
|
9
10
|
subtitle: string;
|
|
10
|
-
|
|
11
|
-
backgroundImageAlt: string;
|
|
11
|
+
backgroundImageDetail: BynderImageDataType;
|
|
12
12
|
button?: NsCardButton;
|
|
13
13
|
className?: string;
|
|
14
14
|
};
|
|
@@ -66,14 +66,13 @@ const CardContainer = styled(Box)(() => {
|
|
|
66
66
|
export default function NsSmallFullCard({
|
|
67
67
|
title,
|
|
68
68
|
subtitle,
|
|
69
|
-
|
|
70
|
-
backgroundImageAlt,
|
|
69
|
+
backgroundImageDetail,
|
|
71
70
|
button,
|
|
72
71
|
className,
|
|
73
72
|
}: NsSmallFullCardProps) {
|
|
74
73
|
return (
|
|
75
74
|
<CardContainer className={className} role="small-full-card" component="div" data-testid="small-full-card">
|
|
76
|
-
<
|
|
75
|
+
<BynderMedia className="image" imageDetail={backgroundImageDetail} />
|
|
77
76
|
<div className="gradientOverlay"></div>
|
|
78
77
|
<div className="content">
|
|
79
78
|
<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 '../';
|
|
4
3
|
import CardButton from './CardButton';
|
|
5
4
|
import { NsCardButton } from './types';
|
|
5
|
+
import { BynderMedia } from '../image/BynderMedia';
|
|
6
|
+
import { BynderImageDataType } from '../image/types';
|
|
6
7
|
|
|
7
8
|
type NsXLargeCardProps = {
|
|
8
9
|
title: string;
|
|
9
10
|
subtitle: string;
|
|
10
|
-
|
|
11
|
-
backgroundImageAlt: string;
|
|
11
|
+
backgroundImageDetail: BynderImageDataType;
|
|
12
12
|
button?: NsCardButton;
|
|
13
13
|
className?: string;
|
|
14
14
|
};
|
|
@@ -59,17 +59,10 @@ const CardContainer = styled(Box)(() => {
|
|
|
59
59
|
};
|
|
60
60
|
});
|
|
61
61
|
|
|
62
|
-
export default function NsXLargeCard({
|
|
63
|
-
title,
|
|
64
|
-
subtitle,
|
|
65
|
-
backgroundImageUrl,
|
|
66
|
-
backgroundImageAlt,
|
|
67
|
-
button,
|
|
68
|
-
className,
|
|
69
|
-
}: NsXLargeCardProps) {
|
|
62
|
+
export default function NsXLargeCard({ title, subtitle, backgroundImageDetail, button, className }: NsXLargeCardProps) {
|
|
70
63
|
return (
|
|
71
64
|
<CardContainer className={className} role="x-large-card" component="div" data-testid="x-large-card">
|
|
72
|
-
<
|
|
65
|
+
<BynderMedia className="image" imageDetail={backgroundImageDetail} />
|
|
73
66
|
<div className="gradientOverlay"></div>
|
|
74
67
|
<div className="content">
|
|
75
68
|
<article className="subtitle">{subtitle}</article>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { BynderImageDataType } from '../../image/types';
|
|
2
|
+
|
|
3
|
+
export const ImageData1: BynderImageDataType = {
|
|
4
|
+
previewUrls: [],
|
|
5
|
+
selected: {
|
|
6
|
+
url: 'https://media.nuskin.com/transform/88d32408-ba18-4b7d-a688-4b91839bae4a/nu-skin-ageloc-lumispa-io-face-cleansing-beauty-device-usage-woman-blue-background-image',
|
|
7
|
+
width: null,
|
|
8
|
+
height: null,
|
|
9
|
+
fileSize: null,
|
|
10
|
+
imageType: 'transformBaseUrl',
|
|
11
|
+
altText: 'image-alt-text',
|
|
12
|
+
type: 'IMAGE',
|
|
13
|
+
fit: 'cover',
|
|
14
|
+
position: 'center center',
|
|
15
|
+
bgColor: '#ffffff',
|
|
16
|
+
},
|
|
17
|
+
isPublic: false,
|
|
18
|
+
type: 'IMAGE',
|
|
19
|
+
id: 'KEFzc2V0X2lkIDg4RDMyNDA4LUJBMTgtNEI3RC1BNjg4NEI5MTgzOUJBRTRBKQ==',
|
|
20
|
+
files: {
|
|
21
|
+
transformBaseUrl: {
|
|
22
|
+
url: 'https://media.nuskin.com/transform/88d32408-ba18-4b7d-a688-4b91839bae4a/nu-skin-ageloc-lumispa-io-face-cleansing-beauty-device-usage-woman-blue-background-image',
|
|
23
|
+
width: null,
|
|
24
|
+
height: null,
|
|
25
|
+
fileSize: null,
|
|
26
|
+
},
|
|
27
|
+
thumbnail: {
|
|
28
|
+
url: 'https://media.nuskin.com/m/3f1f52fbf00a552c/thul-nu-skin-ageloc-lumispa-io-face-cleansing-beauty-device-usage-woman-blue-background-image.png',
|
|
29
|
+
width: 250,
|
|
30
|
+
height: 250,
|
|
31
|
+
fileSize: null,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
databaseId: '88D32408-BA18-4B7D-A6884B91839BAE4A',
|
|
35
|
+
name: 'nu-skin-ageloc-lumispa-io-face-cleansing-beauty-device-usage-woman-blue-background-image',
|
|
36
|
+
description: null,
|
|
37
|
+
};
|
|
38
|
+
export const ImageData1Text = JSON.stringify(ImageData1);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { BynderImageDataType } from '../../image/types';
|
|
2
|
+
|
|
3
|
+
export const ImageData2: BynderImageDataType = {
|
|
4
|
+
previewUrls: [],
|
|
5
|
+
selected: {
|
|
6
|
+
url: 'https://media.nuskin.com/transform/88d32408-ba18-4b7d-a688-4b91839bae4a/nu-skin-ageloc-lumispa-io-face-cleansing-beauty-device-usage-woman-blue-background-image',
|
|
7
|
+
width: null,
|
|
8
|
+
height: null,
|
|
9
|
+
fileSize: null,
|
|
10
|
+
imageType: 'transformBaseUrl',
|
|
11
|
+
altText: 'image-alt-text',
|
|
12
|
+
type: 'IMAGE',
|
|
13
|
+
fit: 'cover',
|
|
14
|
+
position: 'center center',
|
|
15
|
+
bgColor: '#ffffff',
|
|
16
|
+
},
|
|
17
|
+
isPublic: false,
|
|
18
|
+
type: 'IMAGE',
|
|
19
|
+
id: 'KEFzc2V0X2lkIDg4RDMyNDA4LUJBMTgtNEI3RC1BNjg4NEI5MTgzOUJBRTRBKQ==',
|
|
20
|
+
files: {
|
|
21
|
+
transformBaseUrl: {
|
|
22
|
+
url: 'https://media.nuskin.com/transform/88d32408-ba18-4b7d-a688-4b91839bae4a/nu-skin-ageloc-lumispa-io-face-cleansing-beauty-device-usage-woman-blue-background-image',
|
|
23
|
+
width: null,
|
|
24
|
+
height: null,
|
|
25
|
+
fileSize: null,
|
|
26
|
+
},
|
|
27
|
+
thumbnail: {
|
|
28
|
+
url: 'https://media.nuskin.com/m/3f1f52fbf00a552c/thul-nu-skin-ageloc-lumispa-io-face-cleansing-beauty-device-usage-woman-blue-background-image.png',
|
|
29
|
+
width: 250,
|
|
30
|
+
height: 250,
|
|
31
|
+
fileSize: null,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
databaseId: '88D32408-BA18-4B7D-A6884B91839BAE4A',
|
|
35
|
+
name: 'nu-skin-ageloc-lumispa-io-face-cleansing-beauty-device-usage-woman-blue-background-image',
|
|
36
|
+
description: null,
|
|
37
|
+
};
|
|
38
|
+
export const ImageData2Text = JSON.stringify(ImageData2);
|
|
@@ -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';
|
|
4
5
|
|
|
5
6
|
describe('NsHeroCardLevel1 component', () => {
|
|
6
7
|
const props = {
|
|
7
8
|
title: 'AgeLoc LumiSpa iO',
|
|
8
9
|
awardName: '2023 Bronze Winner',
|
|
9
10
|
mediaOutlet: 'Edison Awards',
|
|
10
|
-
|
|
11
|
-
backgroundImageAlt: 'Edison Bronze Logo',
|
|
11
|
+
backgroundImageDetail: ImageData1,
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
it('1. renders with correct content and styles', () => {
|
|
@@ -1,15 +1,14 @@
|
|
|
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';
|
|
4
5
|
|
|
5
6
|
describe('NsHeroCardLevel1 component', () => {
|
|
6
7
|
const props = {
|
|
7
8
|
cardTitle: 'A skin ready for winter',
|
|
8
9
|
cardDescription:
|
|
9
10
|
'We have brought these discoveries to life through our powerful skin care products and supplements.',
|
|
10
|
-
|
|
11
|
-
'https://media.nuskin.com/m/9734240cc191163/webimage-lash-brow-serum-carousel-image-launch.png',
|
|
12
|
-
backgroundImageAlt: 'lash brow serum carousel',
|
|
11
|
+
backgroundImageDetail: ImageData1,
|
|
13
12
|
button: {
|
|
14
13
|
showButton: true,
|
|
15
14
|
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';
|
|
4
5
|
|
|
5
6
|
describe('NsHeroCardLevel2 component', () => {
|
|
6
7
|
const props = {
|
|
7
8
|
cardTitle: 'Current shop deals',
|
|
8
9
|
cardDescription: 'Lumispa, sunscreen and more',
|
|
9
10
|
brandName: 'Beauty focus™',
|
|
10
|
-
|
|
11
|
-
backgroundImageAlt: 'lash brow serum carousel',
|
|
11
|
+
backgroundImageDetail: ImageData1,
|
|
12
12
|
button: {
|
|
13
13
|
showButton: true,
|
|
14
14
|
buttonText: 'Discover more',
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { render, screen } from '@testing-library/react';
|
|
2
2
|
import { NsLargeCard } from '../';
|
|
3
|
+
import { ImageData1 } from '../fixtures/ImageData1';
|
|
3
4
|
|
|
4
5
|
describe('NsLargeCard component', () => {
|
|
5
6
|
const props = {
|
|
@@ -14,9 +15,7 @@ describe('NsLargeCard component', () => {
|
|
|
14
15
|
buttonColor: 'secondary' as 'secondary',
|
|
15
16
|
url: 'https://www.forceforgood.org/',
|
|
16
17
|
},
|
|
17
|
-
|
|
18
|
-
'https://media.nuskin.com/m/95f9cf4143e3882/Small-About_Us-Personal-Care-Products-Image.jpg',
|
|
19
|
-
backgroundImageAlt: 'Facial Moisturizers',
|
|
18
|
+
backgroundImageDetail: ImageData1,
|
|
20
19
|
};
|
|
21
20
|
|
|
22
21
|
it('1. renders with correct content and styles', () => {
|
|
@@ -1,6 +1,7 @@
|
|
|
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';
|
|
4
5
|
|
|
5
6
|
describe('NsMediumCard component', () => {
|
|
6
7
|
const props = {
|
|
@@ -15,8 +16,7 @@ describe('NsMediumCard component', () => {
|
|
|
15
16
|
buttonColor: 'secondary' as 'secondary',
|
|
16
17
|
url: '#',
|
|
17
18
|
},
|
|
18
|
-
|
|
19
|
-
backgroundImageAlt: 'Lumi Spa',
|
|
19
|
+
backgroundImageDetail: ImageData1,
|
|
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(ImageData1.selected?.altText || '');
|
|
37
37
|
expect(imageElement).toBeInTheDocument();
|
|
38
38
|
|
|
39
39
|
const button = screen.queryByText('SEE WHAT WE’RE DOING');
|