@nuskin/foundation-ui-components 1.9.2 → 1.9.3
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/card/CardButton.tsx +31 -0
- package/src/common/card/NsAwardCard.tsx +4 -2
- package/src/common/card/NsBrandCard.tsx +7 -17
- package/src/common/card/NsCheckoutCard.tsx +8 -7
- package/src/common/card/NsHeroCardLevel1.tsx +17 -35
- package/src/common/card/NsHeroCardLevel2.tsx +20 -46
- package/src/common/card/NsIconText.tsx +4 -4
- package/src/common/card/NsLargeCard.tsx +15 -47
- package/src/common/card/NsMediumCard.tsx +10 -21
- package/src/common/card/NsPost.tsx +5 -5
- package/src/common/card/NsSmallFullCard.tsx +10 -19
- package/src/common/card/NsXLargeCard.tsx +10 -9
- package/src/common/card/specs/NsAwardCard.spec.tsx +29 -0
- package/src/common/card/specs/NsBrandCard.spec.tsx +13 -26
- 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 +7 -3
- package/src/common/card/stories/NsCheckoutCard.stories.tsx +3 -4
- package/src/common/card/stories/NsHeroCardLevel1.stories.tsx +10 -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/package.json
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { NsButton, NsIcon } from '..';
|
|
2
|
+
import { NsCardButton } from './types';
|
|
3
|
+
|
|
4
|
+
const CardButton = ({
|
|
5
|
+
url,
|
|
6
|
+
endIcon,
|
|
7
|
+
buttonText,
|
|
8
|
+
showButton = true,
|
|
9
|
+
buttonVariant = 'outlined',
|
|
10
|
+
buttonColor = 'secondary',
|
|
11
|
+
fullWidth = false,
|
|
12
|
+
}: NsCardButton) => {
|
|
13
|
+
if (showButton && url) {
|
|
14
|
+
return (
|
|
15
|
+
<div className="cta">
|
|
16
|
+
<NsButton
|
|
17
|
+
href={url}
|
|
18
|
+
color={buttonColor}
|
|
19
|
+
variant={buttonVariant}
|
|
20
|
+
fullWidth={fullWidth}
|
|
21
|
+
endIcon={endIcon ? <NsIcon name={endIcon} color={buttonColor} /> : null}
|
|
22
|
+
>
|
|
23
|
+
{buttonText}
|
|
24
|
+
</NsButton>
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default CardButton;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Box from '@mui/material/Box';
|
|
2
2
|
import { styled } from '@nuskin/foundation-theme';
|
|
3
|
-
import { NsImage } from '
|
|
3
|
+
import { NsImage } from '../';
|
|
4
4
|
|
|
5
5
|
type NsAwardCardProps = {
|
|
6
6
|
title: string;
|
|
@@ -8,6 +8,7 @@ type NsAwardCardProps = {
|
|
|
8
8
|
mediaOutlet: string;
|
|
9
9
|
backgroundImageUrl: string;
|
|
10
10
|
backgroundImageAlt: string;
|
|
11
|
+
className?: string;
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
const CardContainer = styled(Box)(() => {
|
|
@@ -57,9 +58,10 @@ export default function NsAwardCard({
|
|
|
57
58
|
mediaOutlet,
|
|
58
59
|
backgroundImageUrl,
|
|
59
60
|
backgroundImageAlt,
|
|
61
|
+
className,
|
|
60
62
|
}: NsAwardCardProps) {
|
|
61
63
|
return (
|
|
62
|
-
<CardContainer role="award-card" component="div" data-testid="award-card">
|
|
64
|
+
<CardContainer className={className} role="award-card" component="div" data-testid="award-card">
|
|
63
65
|
<NsImage alt={backgroundImageAlt} src={backgroundImageUrl} className="image" />
|
|
64
66
|
<div className="content">
|
|
65
67
|
<article className="title">{title}</article>
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { ShoppingCart } from '@mui/icons-material';
|
|
2
1
|
import Box from '@mui/material/Box';
|
|
3
2
|
import { styled } from '@nuskin/foundation-theme';
|
|
4
3
|
import { NsTypography } from '../';
|
|
5
4
|
import NsBrandWrapper from './NsBrandWrapper';
|
|
6
5
|
import NsBrandLogo from './NsBrandLogo';
|
|
7
6
|
import NsBgCard from './NsBgCard';
|
|
8
|
-
import NsButton from '../button/NsButton';
|
|
9
7
|
import cardSizes from './cardSizes';
|
|
8
|
+
import CardButton from './CardButton';
|
|
9
|
+
import { NsCardButton } from './types';
|
|
10
10
|
|
|
11
11
|
type NsBrandCardProps = {
|
|
12
12
|
title?: string;
|
|
13
13
|
brandImageUrl: string;
|
|
14
14
|
backgroundImageUrl: string;
|
|
15
15
|
size?: 'small' | 'large';
|
|
16
|
-
button?:
|
|
17
|
-
|
|
16
|
+
button?: NsCardButton;
|
|
17
|
+
className?: string;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
const CardContainer = styled((props: any) => <Box {...props} />)(({ size }) => {
|
|
@@ -64,10 +64,10 @@ export default function NsBrandCard({
|
|
|
64
64
|
backgroundImageUrl,
|
|
65
65
|
button,
|
|
66
66
|
size,
|
|
67
|
-
|
|
67
|
+
className,
|
|
68
68
|
}: NsBrandCardProps) {
|
|
69
69
|
return (
|
|
70
|
-
<CardContainer role="brand-card" component="div" data-testid="brand-card" size={size}
|
|
70
|
+
<CardContainer className={className} role="brand-card" component="div" data-testid="brand-card" size={size}>
|
|
71
71
|
<NsBgCard backgroundImageUrl={backgroundImageUrl} className="image">
|
|
72
72
|
<NsBrandWrapper>
|
|
73
73
|
<NsBrandLogo component="img" image={brandImageUrl} />
|
|
@@ -78,17 +78,7 @@ export default function NsBrandCard({
|
|
|
78
78
|
{title}
|
|
79
79
|
</NsTypography>
|
|
80
80
|
) : null}
|
|
81
|
-
{button ?
|
|
82
|
-
<NsButton
|
|
83
|
-
className="cta"
|
|
84
|
-
darkModeEnabled={false}
|
|
85
|
-
variant="outlined"
|
|
86
|
-
fullWidth={true}
|
|
87
|
-
endIcon={<ShoppingCart />}
|
|
88
|
-
>
|
|
89
|
-
Add to Cart
|
|
90
|
-
</NsButton>
|
|
91
|
-
) : null}
|
|
81
|
+
{button ? <CardButton {...button} /> : null}
|
|
92
82
|
</CardContainer>
|
|
93
83
|
);
|
|
94
84
|
}
|
|
@@ -6,8 +6,9 @@ import { useState } from 'react';
|
|
|
6
6
|
type NsCheckoutCardProps = {
|
|
7
7
|
icon: NsIconNameType;
|
|
8
8
|
title: string;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
linkText: string;
|
|
10
|
+
url: string;
|
|
11
|
+
className?: string;
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
const CardContainer = styled(Box)(() => {
|
|
@@ -58,14 +59,14 @@ const CardContainer = styled(Box)(() => {
|
|
|
58
59
|
};
|
|
59
60
|
});
|
|
60
61
|
|
|
61
|
-
export default function NsCheckoutCard({ title,
|
|
62
|
+
export default function NsCheckoutCard({ title, icon, linkText, url, className }: NsCheckoutCardProps) {
|
|
62
63
|
const [dropdownIcon, setDropdownIcon] = useState(false);
|
|
63
64
|
const handleClick = () => {
|
|
64
65
|
setDropdownIcon(!dropdownIcon);
|
|
65
66
|
};
|
|
66
67
|
|
|
67
68
|
return (
|
|
68
|
-
<CardContainer role="checkout-card" component="div" data-testid="checkout-card"
|
|
69
|
+
<CardContainer className={className} role="checkout-card" component="div" data-testid="checkout-card">
|
|
69
70
|
<div className="left-bar"></div>
|
|
70
71
|
<div className="content">
|
|
71
72
|
<span>
|
|
@@ -73,9 +74,9 @@ export default function NsCheckoutCard({ title, address, icon, onClick }: NsChec
|
|
|
73
74
|
</span>
|
|
74
75
|
<div className="text-content">
|
|
75
76
|
<article className="title">{title}</article>
|
|
76
|
-
<article className="address">
|
|
77
|
-
<NsLink className="action-link" href={
|
|
78
|
-
|
|
77
|
+
<article className="address">Address</article>
|
|
78
|
+
<NsLink className="action-link" href={url}>
|
|
79
|
+
{linkText}
|
|
79
80
|
</NsLink>
|
|
80
81
|
</div>
|
|
81
82
|
<span className="icon-right">
|
|
@@ -1,22 +1,23 @@
|
|
|
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
|
+
};
|
|
14
15
|
|
|
15
16
|
const CardContainer = styled(Box)(() => {
|
|
16
17
|
return {
|
|
17
18
|
backgroundClip: 'border-box',
|
|
18
19
|
display: 'flex',
|
|
19
|
-
flexDirection: 'row' as 'row',
|
|
20
|
+
flexDirection: 'row' as 'row',
|
|
20
21
|
wordWrap: 'break-word' as 'break-word',
|
|
21
22
|
position: 'relative',
|
|
22
23
|
overflow: 'hidden',
|
|
@@ -48,23 +49,7 @@ const CardContainer = styled(Box)(() => {
|
|
|
48
49
|
marginBottom: '20px',
|
|
49
50
|
},
|
|
50
51
|
'.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
52
|
marginTop: '10px',
|
|
62
|
-
borderRadius: '4px',
|
|
63
|
-
|
|
64
|
-
':hover': {
|
|
65
|
-
textDecoration: 'none',
|
|
66
|
-
backgroundColor: '#252w16',
|
|
67
|
-
},
|
|
68
53
|
},
|
|
69
54
|
'@media (max-width: 768px)': {
|
|
70
55
|
display: 'block',
|
|
@@ -80,25 +65,22 @@ const CardContainer = styled(Box)(() => {
|
|
|
80
65
|
});
|
|
81
66
|
|
|
82
67
|
const NsHeroCardLevel1 = ({
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
cardLink,
|
|
68
|
+
cardTitle,
|
|
69
|
+
cardDescription,
|
|
86
70
|
backgroundImageUrl,
|
|
87
71
|
backgroundImageAlt,
|
|
88
|
-
|
|
89
|
-
|
|
72
|
+
button,
|
|
73
|
+
className,
|
|
90
74
|
}: NsHeroCardLevel1Props) => {
|
|
91
75
|
return (
|
|
92
|
-
<CardContainer
|
|
76
|
+
<CardContainer className={className} data-testid="hero-card-level-1">
|
|
93
77
|
<div className="image">
|
|
94
78
|
<NsImage height={'auto'} width={'100%'} alt={backgroundImageAlt} src={backgroundImageUrl} />
|
|
95
79
|
</div>
|
|
96
80
|
<div className="content">
|
|
97
|
-
<article className="body-title">{
|
|
98
|
-
<article className="body-text">{
|
|
99
|
-
<
|
|
100
|
-
{cardLink.title}
|
|
101
|
-
</NsLink>
|
|
81
|
+
<article className="body-title">{cardTitle}</article>
|
|
82
|
+
<article className="body-text">{cardDescription}</article>
|
|
83
|
+
{button ? <CardButton {...button} /> : null}
|
|
102
84
|
</div>
|
|
103
85
|
</CardContainer>
|
|
104
86
|
);
|
|
@@ -1,24 +1,24 @@
|
|
|
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',
|
|
@@ -54,25 +54,6 @@ const CardContainer = styled(Box)(() => {
|
|
|
54
54
|
fontWeight: 700,
|
|
55
55
|
marginBottom: '5px',
|
|
56
56
|
},
|
|
57
|
-
'.cta': {
|
|
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
57
|
'@media (max-width: 768px)': {
|
|
77
58
|
'.content': {
|
|
78
59
|
padding: '5%',
|
|
@@ -92,33 +73,26 @@ const CardContainer = styled(Box)(() => {
|
|
|
92
73
|
});
|
|
93
74
|
|
|
94
75
|
const NsHeroCardLevel2 = ({
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
cardLink,
|
|
76
|
+
brandName,
|
|
77
|
+
cardTitle,
|
|
78
|
+
cardDescription,
|
|
99
79
|
backgroundImageUrl,
|
|
100
80
|
backgroundImageAlt,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
onClick,
|
|
81
|
+
button,
|
|
82
|
+
className,
|
|
104
83
|
}: NsHeroCardLevel2Props) => {
|
|
105
84
|
return (
|
|
106
|
-
<CardContainer
|
|
85
|
+
<CardContainer className={className} data-testid="hero-card-level-2">
|
|
107
86
|
<div className="image">
|
|
108
87
|
<NsImage height={'auto'} width={'100%'} alt={backgroundImageAlt} src={backgroundImageUrl} />
|
|
109
88
|
</div>
|
|
110
89
|
<div className="content">
|
|
111
90
|
<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>
|
|
91
|
+
<article>{brandName}</article>
|
|
121
92
|
</div>
|
|
93
|
+
<article className="body-title">{cardTitle}</article>
|
|
94
|
+
<article className="body-text">{cardDescription}</article>
|
|
95
|
+
<div>{button ? <CardButton {...button} /> : null}</div>
|
|
122
96
|
</div>
|
|
123
97
|
</CardContainer>
|
|
124
98
|
);
|
|
@@ -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,17 +1,18 @@
|
|
|
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
18
|
const CardContainer = styled((props: any) => <Box {...props} />)(({ isHorizontal }) => {
|
|
@@ -57,26 +58,7 @@ const CardContainer = styled((props: any) => <Box {...props} />)(({ isHorizontal
|
|
|
57
58
|
marginTop: '10px',
|
|
58
59
|
},
|
|
59
60
|
'.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
61
|
marginTop: '10px',
|
|
71
|
-
display: 'flex',
|
|
72
|
-
fontWeight: 600,
|
|
73
|
-
width: 'fit-content',
|
|
74
|
-
':hover': {
|
|
75
|
-
textDecoration: 'none',
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
'.icon': {
|
|
79
|
-
marginLeft: '10px',
|
|
80
62
|
},
|
|
81
63
|
};
|
|
82
64
|
});
|
|
@@ -86,39 +68,25 @@ export default function NsLargeCard({
|
|
|
86
68
|
subtitle,
|
|
87
69
|
backgroundImageUrl,
|
|
88
70
|
backgroundImageAlt,
|
|
89
|
-
cardLink,
|
|
90
|
-
buttonVariant,
|
|
91
71
|
intro,
|
|
92
|
-
icon,
|
|
93
72
|
isHorizontal,
|
|
73
|
+
button,
|
|
74
|
+
className,
|
|
94
75
|
}: NsLargeCardProps) {
|
|
95
76
|
return (
|
|
96
|
-
<CardContainer
|
|
77
|
+
<CardContainer
|
|
78
|
+
className={className}
|
|
79
|
+
role="large-card"
|
|
80
|
+
component="div"
|
|
81
|
+
data-testid="large-card"
|
|
82
|
+
isHorizontal={isHorizontal}
|
|
83
|
+
>
|
|
97
84
|
<NsImage alt={backgroundImageAlt} src={backgroundImageUrl} className="image" />
|
|
98
85
|
<div className="content">
|
|
99
86
|
<article className="subtitle">{subtitle}</article>
|
|
100
87
|
<article className="title">{title}</article>
|
|
101
88
|
<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
|
-
)}
|
|
89
|
+
{button ? <CardButton {...button} /> : null}
|
|
122
90
|
</div>
|
|
123
91
|
</CardContainer>
|
|
124
92
|
);
|
|
@@ -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,13 +7,14 @@ 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',
|
|
@@ -41,9 +41,9 @@ const CardContainer = styled(Box)(() => {
|
|
|
41
41
|
};
|
|
42
42
|
});
|
|
43
43
|
|
|
44
|
-
const NsPost = ({ text, body, backgroundImageUrl, backgroundImageAlt,
|
|
44
|
+
const NsPost = ({ text, body, backgroundImageUrl, backgroundImageAlt, className }: NsPostProps) => {
|
|
45
45
|
return (
|
|
46
|
-
<CardContainer data-testid=
|
|
46
|
+
<CardContainer className={className} data-testid="post-card">
|
|
47
47
|
<div className="image">
|
|
48
48
|
<NsImage height="auto" width="100%" alt={backgroundImageAlt} src={backgroundImageUrl} />
|
|
49
49
|
</div>
|
|
@@ -1,13 +1,16 @@
|
|
|
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)(() => {
|
|
@@ -50,19 +53,8 @@ const CardContainer = styled(Box)(() => {
|
|
|
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
|
);
|