@nuskin/foundation-ui-components 1.9.2 → 1.9.4
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 +6 -6
- package/src/common/autocomplete/NsAutocomplete.spec.tsx +22 -28
- package/src/common/autocomplete/NsAutocomplete.styled.tsx +6 -8
- package/src/common/autocomplete/NsAutocomplete.tsx +14 -8
- package/src/common/autocomplete/helper/LineLoader.tsx +37 -0
- package/src/common/autocomplete/helper/RecentClearAll.tsx +36 -0
- package/src/common/autocomplete/helper/SeeMoreButton.tsx +31 -4
- package/src/common/autocomplete/helper/index.ts +4 -0
- package/src/common/autocomplete/helper/renderGroupName.tsx +0 -1
- package/src/common/autocomplete/mock/MockData.ts +13 -14
- package/src/common/autocomplete/mock/MockUI.tsx +4 -5
- package/src/common/autocomplete/types.d.ts +1 -0
- package/src/common/card/CardButton.tsx +31 -0
- package/src/common/card/NsAwardCard.tsx +8 -5
- package/src/common/card/NsBrandCard.tsx +8 -17
- package/src/common/card/NsCheckoutCard.tsx +8 -7
- package/src/common/card/NsHeroCardLevel1.tsx +39 -50
- package/src/common/card/NsHeroCardLevel2.tsx +28 -67
- package/src/common/card/NsIconText.tsx +4 -4
- package/src/common/card/NsLargeCard.tsx +28 -55
- package/src/common/card/NsMediumCard.tsx +10 -21
- package/src/common/card/NsPost.tsx +13 -8
- package/src/common/card/NsSmallFullCard.tsx +13 -22
- package/src/common/card/NsXLargeCard.tsx +12 -11
- package/src/common/card/cardSizes.ts +4 -4
- package/src/common/card/specs/NsAwardCard.spec.tsx +29 -0
- package/src/common/card/specs/NsBrandCard.spec.tsx +18 -31
- package/src/common/card/specs/NsCheckoutCard.spec.tsx +4 -15
- package/src/common/card/specs/NsHeroCardLevel1.spec.tsx +16 -24
- package/src/common/card/specs/NsHeroCardLevel2.spec.tsx +18 -20
- package/src/common/card/specs/NsIconText.spec.tsx +0 -3
- package/src/common/card/specs/NsLargeCard.spec.tsx +26 -19
- package/src/common/card/specs/NsMediumCard.spec.tsx +28 -12
- package/src/common/card/specs/NsPost.spec.tsx +8 -11
- package/src/common/card/specs/NsSmallFullCard.spec.tsx +23 -12
- package/src/common/card/specs/NsXLargeCard.spec.tsx +23 -11
- package/src/common/card/stories/NsAwardCard.stories.tsx +0 -3
- package/src/common/card/stories/NsBrandCard.stories.tsx +8 -3
- package/src/common/card/stories/NsCheckoutCard.stories.tsx +3 -4
- package/src/common/card/stories/NsHeroCardLevel1.stories.tsx +11 -24
- package/src/common/card/stories/NsHeroCardLevel2.stories.tsx +10 -29
- package/src/common/card/stories/NsIconText.stories.tsx +2 -20
- package/src/common/card/stories/NsLargeCard.stories.tsx +8 -7
- package/src/common/card/stories/NsMediumCard.stories.tsx +7 -6
- package/src/common/card/stories/NsPost.stories.tsx +2 -19
- package/src/common/card/stories/NsSmallFullCard.stories.tsx +7 -4
- package/src/common/card/stories/NsXLargeCard.stories.tsx +8 -4
- package/src/common/card/types.d.ts +12 -0
- package/src/common/carousal/RenderBrand.tsx +0 -1
- package/src/common/autocomplete/helper/AutoCompleteButton.tsx +0 -24
|
@@ -1,29 +1,35 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NsImage } from '../';
|
|
2
2
|
import Box from '@mui/material/Box';
|
|
3
|
-
import { AdditionalProps } from '../common.types';
|
|
4
3
|
import { styled } from '@nuskin/foundation-theme';
|
|
4
|
+
import CardButton from './CardButton';
|
|
5
|
+
import { NsCardButton } from './types';
|
|
5
6
|
|
|
6
7
|
type NsHeroCardLevel1Props = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
cardLink: { href: string; title: string };
|
|
8
|
+
cardTitle: string;
|
|
9
|
+
cardDescription: string;
|
|
10
10
|
backgroundImageUrl: string;
|
|
11
11
|
backgroundImageAlt: string;
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
button?: NsCardButton;
|
|
13
|
+
className?: string;
|
|
14
|
+
imagePosition?: 'top' | 'bottom';
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const CardContainer = styled((props: any) => <Box {...props} />)(({ imagePosition }) => {
|
|
18
|
+
const imageDirection = imagePosition === 'top' ? 'column' : 'column-reverse';
|
|
14
19
|
|
|
15
|
-
const CardContainer = styled(Box)(() => {
|
|
16
20
|
return {
|
|
17
21
|
backgroundClip: 'border-box',
|
|
18
22
|
display: 'flex',
|
|
19
|
-
flexDirection: 'row' as 'row', // https://github.com/cssinjs/jss/issues/1344
|
|
20
23
|
wordWrap: 'break-word' as 'break-word',
|
|
21
24
|
position: 'relative',
|
|
22
25
|
overflow: 'hidden',
|
|
23
|
-
|
|
26
|
+
width: '100%',
|
|
27
|
+
height: '500px',
|
|
28
|
+
flexDirection: 'row',
|
|
24
29
|
'.content': {
|
|
25
30
|
width: '50%',
|
|
26
|
-
|
|
31
|
+
minWidth: '300px',
|
|
32
|
+
height: '500px',
|
|
27
33
|
padding: '50px',
|
|
28
34
|
paddingLeft: '100px',
|
|
29
35
|
display: 'flex',
|
|
@@ -33,10 +39,8 @@ const CardContainer = styled(Box)(() => {
|
|
|
33
39
|
left: 0,
|
|
34
40
|
boxSizing: 'border-box',
|
|
35
41
|
},
|
|
36
|
-
'.image': {
|
|
37
|
-
|
|
38
|
-
height: '100%',
|
|
39
|
-
display: 'block',
|
|
42
|
+
'.bg-image': {
|
|
43
|
+
objectFit: 'cover',
|
|
40
44
|
},
|
|
41
45
|
'.body-title': {
|
|
42
46
|
fontSize: '36px',
|
|
@@ -48,29 +52,19 @@ const CardContainer = styled(Box)(() => {
|
|
|
48
52
|
marginBottom: '20px',
|
|
49
53
|
},
|
|
50
54
|
'.action-link': {
|
|
51
|
-
display: 'flex',
|
|
52
|
-
height: '44px',
|
|
53
|
-
flexDirection: 'column',
|
|
54
|
-
justifyContent: 'center',
|
|
55
|
-
alignItems: 'center',
|
|
56
|
-
gap: '10px',
|
|
57
|
-
flexShrink: 0,
|
|
58
|
-
alignSelf: 'stretch',
|
|
59
|
-
backgroundColor: '#252525',
|
|
60
|
-
color: '#fff',
|
|
61
55
|
marginTop: '10px',
|
|
62
|
-
borderRadius: '4px',
|
|
63
|
-
|
|
64
|
-
':hover': {
|
|
65
|
-
textDecoration: 'none',
|
|
66
|
-
backgroundColor: '#252w16',
|
|
67
|
-
},
|
|
68
56
|
},
|
|
69
57
|
'@media (max-width: 768px)': {
|
|
70
|
-
|
|
58
|
+
'.content': {
|
|
59
|
+
paddingLeft: '20px',
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
'@media (max-width: 430px)': {
|
|
71
63
|
height: 'auto',
|
|
72
64
|
backgroundColor: '#edece9',
|
|
65
|
+
flexDirection: imageDirection,
|
|
73
66
|
'.content': {
|
|
67
|
+
height: 'auto',
|
|
74
68
|
position: 'static',
|
|
75
69
|
width: '100%',
|
|
76
70
|
padding: '20px',
|
|
@@ -79,28 +73,23 @@ const CardContainer = styled(Box)(() => {
|
|
|
79
73
|
};
|
|
80
74
|
});
|
|
81
75
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
cardLink,
|
|
76
|
+
export default function NsHeroCardLevel1({
|
|
77
|
+
cardTitle,
|
|
78
|
+
cardDescription,
|
|
86
79
|
backgroundImageUrl,
|
|
87
80
|
backgroundImageAlt,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
81
|
+
button,
|
|
82
|
+
className,
|
|
83
|
+
imagePosition = 'top',
|
|
84
|
+
}: NsHeroCardLevel1Props) {
|
|
91
85
|
return (
|
|
92
|
-
<CardContainer data-testid=
|
|
93
|
-
<
|
|
94
|
-
<NsImage height={'auto'} width={'100%'} alt={backgroundImageAlt} src={backgroundImageUrl} />
|
|
95
|
-
</div>
|
|
86
|
+
<CardContainer className={className} data-testid="hero-card-level-1" imagePosition={imagePosition}>
|
|
87
|
+
<NsImage variant="fill" alt={backgroundImageAlt} src={backgroundImageUrl} className="bg-image" />
|
|
96
88
|
<div className="content">
|
|
97
|
-
<article className="body-title">{
|
|
98
|
-
<article className="body-text">{
|
|
99
|
-
<
|
|
100
|
-
{cardLink.title}
|
|
101
|
-
</NsLink>
|
|
89
|
+
<article className="body-title">{cardTitle}</article>
|
|
90
|
+
<article className="body-text">{cardDescription}</article>
|
|
91
|
+
{button ? <CardButton {...button} /> : null}
|
|
102
92
|
</div>
|
|
103
93
|
</CardContainer>
|
|
104
94
|
);
|
|
105
|
-
}
|
|
106
|
-
export default NsHeroCardLevel1;
|
|
95
|
+
}
|
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NsImage } from '../';
|
|
2
2
|
import Box from '@mui/material/Box';
|
|
3
|
-
import { AdditionalProps } from '../common.types';
|
|
4
3
|
import { styled } from '@nuskin/foundation-theme';
|
|
4
|
+
import CardButton from './CardButton';
|
|
5
|
+
import { NsCardButton } from './types';
|
|
5
6
|
|
|
6
7
|
type NsHeroCardLevel2Props = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
icon: NsIconNameType;
|
|
11
|
-
cardLink: { href: string; title: string };
|
|
8
|
+
brandName: string;
|
|
9
|
+
cardTitle: string;
|
|
10
|
+
cardDescription: string;
|
|
12
11
|
backgroundImageUrl: string;
|
|
13
12
|
backgroundImageAlt: string;
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
button?: NsCardButton;
|
|
14
|
+
className?: string;
|
|
15
|
+
};
|
|
16
16
|
|
|
17
17
|
const CardContainer = styled(Box)(() => {
|
|
18
18
|
return {
|
|
19
19
|
backgroundClip: 'border-box',
|
|
20
20
|
display: 'flex',
|
|
21
|
-
flexDirection: 'row' as 'row',
|
|
21
|
+
flexDirection: 'row' as 'row',
|
|
22
22
|
wordWrap: 'break-word' as 'break-word',
|
|
23
23
|
position: 'relative',
|
|
24
24
|
overflow: 'hidden',
|
|
25
|
-
height: '
|
|
25
|
+
height: '250px',
|
|
26
|
+
width: '100%',
|
|
26
27
|
'.content': {
|
|
27
28
|
height: '100%',
|
|
28
29
|
padding: '50px',
|
|
@@ -33,10 +34,8 @@ const CardContainer = styled(Box)(() => {
|
|
|
33
34
|
left: 0,
|
|
34
35
|
boxSizing: 'border-box',
|
|
35
36
|
},
|
|
36
|
-
'.image': {
|
|
37
|
-
|
|
38
|
-
height: '100%',
|
|
39
|
-
display: 'block',
|
|
37
|
+
'.bg-image': {
|
|
38
|
+
objectFit: 'cover',
|
|
40
39
|
},
|
|
41
40
|
'.brand-container': {
|
|
42
41
|
backgroundColor: '#fff',
|
|
@@ -45,80 +44,42 @@ const CardContainer = styled(Box)(() => {
|
|
|
45
44
|
paddingRight: '10px',
|
|
46
45
|
},
|
|
47
46
|
'.body-title': {
|
|
48
|
-
fontSize: '
|
|
47
|
+
fontSize: '26px',
|
|
49
48
|
lineHeight: '44px',
|
|
50
49
|
marginBottom: '5px',
|
|
51
50
|
},
|
|
52
51
|
'.body-text': {
|
|
53
|
-
fontSize: '
|
|
52
|
+
fontSize: '12px',
|
|
54
53
|
fontWeight: 700,
|
|
55
54
|
marginBottom: '5px',
|
|
56
55
|
},
|
|
57
|
-
'
|
|
58
|
-
display: 'flex',
|
|
59
|
-
flexDirection: 'column' as 'column',
|
|
60
|
-
width: 'fit-content',
|
|
61
|
-
borderBottom: '1px solid black',
|
|
62
|
-
':hover': {
|
|
63
|
-
opacity: '0.8',
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
'.action-link': {
|
|
67
|
-
display: 'flex',
|
|
68
|
-
fontWeight: 600,
|
|
69
|
-
':hover': {
|
|
70
|
-
textDecoration: 'none',
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
'.icon': {
|
|
74
|
-
marginLeft: '10px',
|
|
75
|
-
},
|
|
76
|
-
'@media (max-width: 768px)': {
|
|
56
|
+
'@media (max-width:768px)': {
|
|
77
57
|
'.content': {
|
|
78
58
|
padding: '5%',
|
|
79
59
|
},
|
|
80
|
-
'.body-title': {
|
|
81
|
-
fontSize: '18px',
|
|
82
|
-
lineHeight: '44px',
|
|
83
|
-
marginBottom: '5px',
|
|
84
|
-
},
|
|
85
|
-
'.body-text': {
|
|
86
|
-
fontSize: '12px',
|
|
87
|
-
fontWeight: 700,
|
|
88
|
-
marginBottom: '5px',
|
|
89
|
-
},
|
|
90
60
|
},
|
|
91
61
|
};
|
|
92
62
|
});
|
|
93
63
|
|
|
94
64
|
const NsHeroCardLevel2 = ({
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
cardLink,
|
|
65
|
+
brandName,
|
|
66
|
+
cardTitle,
|
|
67
|
+
cardDescription,
|
|
99
68
|
backgroundImageUrl,
|
|
100
69
|
backgroundImageAlt,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
onClick,
|
|
70
|
+
button,
|
|
71
|
+
className,
|
|
104
72
|
}: NsHeroCardLevel2Props) => {
|
|
105
73
|
return (
|
|
106
|
-
<CardContainer
|
|
107
|
-
<
|
|
108
|
-
<NsImage height={'auto'} width={'100%'} alt={backgroundImageAlt} src={backgroundImageUrl} />
|
|
109
|
-
</div>
|
|
74
|
+
<CardContainer className={className} data-testid="hero-card-level-2">
|
|
75
|
+
<NsImage variant="fill" alt={backgroundImageAlt} src={backgroundImageUrl} className="bg-image" />
|
|
110
76
|
<div className="content">
|
|
111
77
|
<div className="brand-container">
|
|
112
|
-
<article>{
|
|
113
|
-
</div>
|
|
114
|
-
<article className="body-title">{text}</article>
|
|
115
|
-
<article className="body-text">{body}</article>
|
|
116
|
-
<div className="cta">
|
|
117
|
-
<NsLink className="action-link" href={cardLink.href}>
|
|
118
|
-
{cardLink.title}
|
|
119
|
-
<NsIcon className="icon" name={icon} />
|
|
120
|
-
</NsLink>
|
|
78
|
+
<article>{brandName}</article>
|
|
121
79
|
</div>
|
|
80
|
+
<article className="body-title">{cardTitle}</article>
|
|
81
|
+
<article className="body-text">{cardDescription}</article>
|
|
82
|
+
<div>{button ? <CardButton {...button} /> : null}</div>
|
|
122
83
|
</div>
|
|
123
84
|
</CardContainer>
|
|
124
85
|
);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import Box from '@mui/material/Box';
|
|
2
|
-
import { AdditionalProps } from '../common.types';
|
|
3
2
|
import { styled } from '@nuskin/foundation-theme';
|
|
4
3
|
|
|
5
4
|
type NsIconTextProps = {
|
|
6
5
|
text: string;
|
|
7
6
|
body: string;
|
|
8
|
-
|
|
7
|
+
className?: string;
|
|
8
|
+
};
|
|
9
9
|
|
|
10
10
|
const CardContainer = styled(Box)(() => {
|
|
11
11
|
return {
|
|
@@ -42,9 +42,9 @@ const CardContainer = styled(Box)(() => {
|
|
|
42
42
|
};
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
-
const NsIconText = ({ text, body,
|
|
45
|
+
const NsIconText = ({ text, body, className }: NsIconTextProps) => {
|
|
46
46
|
return (
|
|
47
|
-
<CardContainer data-testid=
|
|
47
|
+
<CardContainer className={className} data-testid="icon-text-card">
|
|
48
48
|
<div className="icon">
|
|
49
49
|
<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 80 80" fill="none">
|
|
50
50
|
<path
|
|
@@ -1,32 +1,35 @@
|
|
|
1
1
|
import Box from '@mui/material/Box';
|
|
2
2
|
import { styled } from '@nuskin/foundation-theme';
|
|
3
|
-
import {
|
|
3
|
+
import { NsImage } from '../';
|
|
4
|
+
import CardButton from './CardButton';
|
|
5
|
+
import { NsCardButton } from './types';
|
|
4
6
|
|
|
5
7
|
type NsLargeCardProps = {
|
|
6
8
|
title: string;
|
|
7
9
|
subtitle?: string;
|
|
8
10
|
intro: string;
|
|
9
|
-
icon?: NsIconNameType;
|
|
10
|
-
buttonVariant?: 'text' | 'outlined' | 'contained';
|
|
11
11
|
backgroundImageUrl: string;
|
|
12
12
|
backgroundImageAlt: string;
|
|
13
|
-
cardLink: { href: string; title: string };
|
|
14
13
|
isHorizontal?: boolean;
|
|
14
|
+
button?: NsCardButton;
|
|
15
|
+
className?: string;
|
|
15
16
|
};
|
|
16
17
|
|
|
17
|
-
const CardContainer = styled((props: any) => <Box {...props} />)(({ isHorizontal }) => {
|
|
18
|
-
let width = '
|
|
18
|
+
const CardContainer = styled((props: any) => <Box {...props} />)(({ isHorizontal, matches }) => {
|
|
19
|
+
let width = '450px',
|
|
19
20
|
paddingLeft = '0px',
|
|
20
21
|
justifyContent,
|
|
21
22
|
fontSizeSub = '16px',
|
|
22
|
-
fontSizeTitle = '26px'
|
|
23
|
+
fontSizeTitle = '26px',
|
|
24
|
+
imageWidth = '100%';
|
|
23
25
|
|
|
24
26
|
if (isHorizontal) {
|
|
25
|
-
width = '
|
|
27
|
+
width = '600px';
|
|
26
28
|
paddingLeft = '30px';
|
|
27
29
|
justifyContent = 'center';
|
|
28
30
|
fontSizeSub = '16px';
|
|
29
|
-
fontSizeTitle = '
|
|
31
|
+
fontSizeTitle = '26px';
|
|
32
|
+
imageWidth = '50%';
|
|
30
33
|
}
|
|
31
34
|
let direction = isHorizontal ? ('row' as 'row') : ('column' as 'column');
|
|
32
35
|
|
|
@@ -35,10 +38,10 @@ const CardContainer = styled((props: any) => <Box {...props} />)(({ isHorizontal
|
|
|
35
38
|
flexDirection: direction,
|
|
36
39
|
position: 'relative',
|
|
37
40
|
width,
|
|
38
|
-
'.image': {
|
|
39
|
-
width: '375px',
|
|
40
|
-
height: 'auto',
|
|
41
|
+
'.bg-image': {
|
|
41
42
|
objectFit: 'cover',
|
|
43
|
+
height: '220px',
|
|
44
|
+
width: imageWidth,
|
|
42
45
|
},
|
|
43
46
|
'.content': {
|
|
44
47
|
display: 'flex',
|
|
@@ -57,26 +60,10 @@ const CardContainer = styled((props: any) => <Box {...props} />)(({ isHorizontal
|
|
|
57
60
|
marginTop: '10px',
|
|
58
61
|
},
|
|
59
62
|
'.cta': {
|
|
60
|
-
display: 'flex',
|
|
61
|
-
flexDirection: 'column' as 'column',
|
|
62
|
-
width: 'fit-content',
|
|
63
|
-
|
|
64
|
-
borderBottom: '1px solid black',
|
|
65
|
-
':hover': {
|
|
66
|
-
opacity: '0.8',
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
'.action-link': {
|
|
70
63
|
marginTop: '10px',
|
|
71
|
-
display: 'flex',
|
|
72
|
-
fontWeight: 600,
|
|
73
|
-
width: 'fit-content',
|
|
74
|
-
':hover': {
|
|
75
|
-
textDecoration: 'none',
|
|
76
|
-
},
|
|
77
64
|
},
|
|
78
|
-
'
|
|
79
|
-
|
|
65
|
+
'@media (max-width: 768px)': {
|
|
66
|
+
width: '100%',
|
|
80
67
|
},
|
|
81
68
|
};
|
|
82
69
|
});
|
|
@@ -86,39 +73,25 @@ export default function NsLargeCard({
|
|
|
86
73
|
subtitle,
|
|
87
74
|
backgroundImageUrl,
|
|
88
75
|
backgroundImageAlt,
|
|
89
|
-
cardLink,
|
|
90
|
-
buttonVariant,
|
|
91
76
|
intro,
|
|
92
|
-
icon,
|
|
93
77
|
isHorizontal,
|
|
78
|
+
button,
|
|
79
|
+
className,
|
|
94
80
|
}: NsLargeCardProps) {
|
|
95
81
|
return (
|
|
96
|
-
<CardContainer
|
|
97
|
-
|
|
82
|
+
<CardContainer
|
|
83
|
+
className={className}
|
|
84
|
+
role="large-card"
|
|
85
|
+
component="div"
|
|
86
|
+
data-testid="large-card"
|
|
87
|
+
isHorizontal={isHorizontal}
|
|
88
|
+
>
|
|
89
|
+
<NsImage alt={backgroundImageAlt} src={backgroundImageUrl} className="bg-image" />
|
|
98
90
|
<div className="content">
|
|
99
91
|
<article className="subtitle">{subtitle}</article>
|
|
100
92
|
<article className="title">{title}</article>
|
|
101
93
|
<article className="subtitle">{intro}</article>
|
|
102
|
-
{
|
|
103
|
-
<div className="cta">
|
|
104
|
-
<NsLink className="action-link" href={cardLink.href}>
|
|
105
|
-
{cardLink.title}
|
|
106
|
-
<NsIcon className="icon" name={icon} />
|
|
107
|
-
</NsLink>
|
|
108
|
-
</div>
|
|
109
|
-
) : (
|
|
110
|
-
<NsButton
|
|
111
|
-
className="action-link"
|
|
112
|
-
variant={buttonVariant}
|
|
113
|
-
color="primary"
|
|
114
|
-
href={cardLink.href}
|
|
115
|
-
fullWidth={false}
|
|
116
|
-
darkModeEnabled={false}
|
|
117
|
-
endIcon={buttonVariant !== 'contained' ? <NsIcon className="icon" name={icon} /> : null}
|
|
118
|
-
>
|
|
119
|
-
{cardLink.title}
|
|
120
|
-
</NsButton>
|
|
121
|
-
)}
|
|
94
|
+
{button ? <CardButton {...button} /> : null}
|
|
122
95
|
</div>
|
|
123
96
|
</CardContainer>
|
|
124
97
|
);
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import Box from '@mui/material/Box';
|
|
2
2
|
import { styled } from '@nuskin/foundation-theme';
|
|
3
|
-
import {
|
|
3
|
+
import { NsImage, NsTypography } from '../';
|
|
4
|
+
import CardButton from './CardButton';
|
|
5
|
+
import { NsCardButton } from './types';
|
|
4
6
|
|
|
5
7
|
type NsMediumCardProps = {
|
|
6
8
|
title: string;
|
|
7
9
|
titleFontWeight?: 'bold' | 'normal' | 'light';
|
|
8
10
|
subtitle: string;
|
|
9
|
-
icon?: NsIconNameType;
|
|
10
11
|
backgroundImageUrl: string;
|
|
11
12
|
backgroundImageAlt: string;
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
button?: NsCardButton;
|
|
14
|
+
className?: string;
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
const CardContainer = styled(Box)(() => {
|
|
@@ -37,10 +38,8 @@ const CardContainer = styled(Box)(() => {
|
|
|
37
38
|
fontSize: '20px',
|
|
38
39
|
marginTop: '10px',
|
|
39
40
|
},
|
|
40
|
-
'.
|
|
41
|
+
'.cta': {
|
|
41
42
|
marginTop: '10px',
|
|
42
|
-
fontSize: '14px',
|
|
43
|
-
alignSelf: 'start',
|
|
44
43
|
},
|
|
45
44
|
};
|
|
46
45
|
});
|
|
@@ -51,28 +50,18 @@ export default function NsMediumCard({
|
|
|
51
50
|
subtitle,
|
|
52
51
|
backgroundImageUrl,
|
|
53
52
|
backgroundImageAlt,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
buttonVariant,
|
|
53
|
+
button,
|
|
54
|
+
className,
|
|
57
55
|
}: NsMediumCardProps) {
|
|
58
56
|
return (
|
|
59
|
-
<CardContainer role="medium-card" component="div" data-testid="medium-card">
|
|
57
|
+
<CardContainer className={className} role="medium-card" component="div" data-testid="medium-card">
|
|
60
58
|
<NsImage alt={backgroundImageAlt} src={backgroundImageUrl} className="image" />
|
|
61
59
|
<div className="content">
|
|
62
60
|
<NsTypography variant="h5" color="primary" className="title" weight={titleFontWeight}>
|
|
63
61
|
{title}
|
|
64
62
|
</NsTypography>
|
|
65
63
|
<article className="subtitle">{subtitle}</article>
|
|
66
|
-
<
|
|
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
|
-
>
|
|
74
|
-
{cardLink.title}
|
|
75
|
-
</NsButton>
|
|
64
|
+
{button ? <CardButton {...button} /> : null}
|
|
76
65
|
</div>
|
|
77
66
|
</CardContainer>
|
|
78
67
|
);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import Box from '@mui/material/Box';
|
|
2
2
|
import { NsImage } from '../';
|
|
3
|
-
import { AdditionalProps } from '../common.types';
|
|
4
3
|
import { styled } from '@nuskin/foundation-theme';
|
|
5
4
|
|
|
6
5
|
type NsPostProps = {
|
|
@@ -8,30 +7,36 @@ type NsPostProps = {
|
|
|
8
7
|
body: string;
|
|
9
8
|
backgroundImageUrl: string;
|
|
10
9
|
backgroundImageAlt: string;
|
|
11
|
-
|
|
10
|
+
className?: string;
|
|
11
|
+
};
|
|
12
12
|
|
|
13
13
|
const CardContainer = styled(Box)(() => {
|
|
14
14
|
return {
|
|
15
15
|
backgroundClip: 'border-box',
|
|
16
16
|
display: 'flex',
|
|
17
|
-
flexDirection: 'column' as 'column',
|
|
17
|
+
flexDirection: 'column' as 'column',
|
|
18
18
|
wordWrap: 'break-word' as 'break-word',
|
|
19
19
|
position: 'relative',
|
|
20
20
|
overflow: 'hidden',
|
|
21
|
-
height: '
|
|
22
|
-
width: '
|
|
21
|
+
height: '350px',
|
|
22
|
+
width: '210px',
|
|
23
23
|
backgroundColor: '#fff',
|
|
24
24
|
'.content': {
|
|
25
25
|
padding: '10px',
|
|
26
26
|
display: 'flex',
|
|
27
27
|
flexDirection: 'column',
|
|
28
|
-
minHeight: '
|
|
28
|
+
minHeight: '80px',
|
|
29
29
|
justifyContent: 'space-between',
|
|
30
30
|
},
|
|
31
31
|
'.body-title': {
|
|
32
32
|
fontSize: '18px',
|
|
33
33
|
marginBottom: '5px',
|
|
34
34
|
fontWeight: 600,
|
|
35
|
+
display: '-webkit-box',
|
|
36
|
+
'-webkit-box-orient': 'vertical',
|
|
37
|
+
'-webkit-line-clamp': '3',
|
|
38
|
+
overflow: 'hidden',
|
|
39
|
+
textOverflow: 'ellipsis',
|
|
35
40
|
},
|
|
36
41
|
'.body-text': {
|
|
37
42
|
fontSize: '12px',
|
|
@@ -41,9 +46,9 @@ const CardContainer = styled(Box)(() => {
|
|
|
41
46
|
};
|
|
42
47
|
});
|
|
43
48
|
|
|
44
|
-
const NsPost = ({ text, body, backgroundImageUrl, backgroundImageAlt,
|
|
49
|
+
const NsPost = ({ text, body, backgroundImageUrl, backgroundImageAlt, className }: NsPostProps) => {
|
|
45
50
|
return (
|
|
46
|
-
<CardContainer data-testid=
|
|
51
|
+
<CardContainer className={className} data-testid="post-card">
|
|
47
52
|
<div className="image">
|
|
48
53
|
<NsImage height="auto" width="100%" alt={backgroundImageAlt} src={backgroundImageUrl} />
|
|
49
54
|
</div>
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
import Box from '@mui/material/Box';
|
|
2
2
|
import { styled } from '@nuskin/foundation-theme';
|
|
3
|
-
import { NsImage
|
|
3
|
+
import { NsImage } from '../';
|
|
4
|
+
import { NsCardButton } from './types';
|
|
5
|
+
import CardButton from './CardButton';
|
|
4
6
|
|
|
5
7
|
type NsSmallFullCardProps = {
|
|
6
8
|
title: string;
|
|
7
9
|
subtitle: string;
|
|
8
10
|
backgroundImageUrl: string;
|
|
9
11
|
backgroundImageAlt: string;
|
|
10
|
-
|
|
12
|
+
button?: NsCardButton;
|
|
13
|
+
className?: string;
|
|
11
14
|
};
|
|
12
15
|
|
|
13
16
|
const CardContainer = styled(Box)(() => {
|
|
14
17
|
return {
|
|
15
18
|
backgroundColor: '#fff',
|
|
16
19
|
display: 'flex',
|
|
17
|
-
height: '
|
|
18
|
-
width: '
|
|
20
|
+
height: '275px',
|
|
21
|
+
width: '250px',
|
|
19
22
|
position: 'relative',
|
|
20
23
|
'.image': {
|
|
21
24
|
width: '100%',
|
|
@@ -46,23 +49,12 @@ const CardContainer = styled(Box)(() => {
|
|
|
46
49
|
},
|
|
47
50
|
'.title': {
|
|
48
51
|
color: '#fff',
|
|
49
|
-
fontSize: '
|
|
52
|
+
fontSize: '22px',
|
|
50
53
|
fontWeight: '400',
|
|
51
54
|
marginTop: '20px',
|
|
52
55
|
},
|
|
53
|
-
'.
|
|
54
|
-
display: 'flex',
|
|
55
|
-
justifyContent: 'center',
|
|
56
|
-
backgroundColor: '#252525',
|
|
57
|
-
color: '#fff',
|
|
56
|
+
'.cta': {
|
|
58
57
|
marginTop: '20px',
|
|
59
|
-
borderRadius: '4px',
|
|
60
|
-
padding: '10px',
|
|
61
|
-
width: '70%',
|
|
62
|
-
':hover': {
|
|
63
|
-
textDecoration: 'none',
|
|
64
|
-
backgroundColor: '#3e3e3e',
|
|
65
|
-
},
|
|
66
58
|
},
|
|
67
59
|
};
|
|
68
60
|
});
|
|
@@ -72,18 +64,17 @@ export default function NsSmallFullCard({
|
|
|
72
64
|
subtitle,
|
|
73
65
|
backgroundImageUrl,
|
|
74
66
|
backgroundImageAlt,
|
|
75
|
-
|
|
67
|
+
button,
|
|
68
|
+
className,
|
|
76
69
|
}: NsSmallFullCardProps) {
|
|
77
70
|
return (
|
|
78
|
-
<CardContainer role="small-full-card" component="div" data-testid="small-full-card">
|
|
71
|
+
<CardContainer className={className} role="small-full-card" component="div" data-testid="small-full-card">
|
|
79
72
|
<NsImage alt={backgroundImageAlt} src={backgroundImageUrl} className="image" />
|
|
80
73
|
<div className="gradientOverlay"></div>
|
|
81
74
|
<div className="content">
|
|
82
75
|
<article className="subtitle">{subtitle}</article>
|
|
83
76
|
<article className="title">{title}</article>
|
|
84
|
-
<
|
|
85
|
-
{cardLink.title}
|
|
86
|
-
</NsLink>
|
|
77
|
+
{button ? <CardButton {...button} /> : null}
|
|
87
78
|
</div>
|
|
88
79
|
</CardContainer>
|
|
89
80
|
);
|