@nuskin/foundation-ui-components 1.19.4-cx130-1001.1 → 1.19.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 +1 -1
- package/src/common/button/NsButton.styled.tsx +0 -1
- package/src/common/card/CardButton.tsx +13 -32
- package/src/common/card/NsBrandCard.tsx +13 -12
- package/src/common/card/NsCheckoutCard.tsx +1 -1
- package/src/common/card/NsHeroCardLevel1.tsx +2 -2
- package/src/common/card/NsHeroCardLevel2.tsx +2 -2
- package/src/common/card/NsIconText.tsx +1 -1
- package/src/common/card/NsPost.tsx +24 -24
- package/src/common/card/NsSmallFullCard.tsx +3 -7
- package/src/common/card/cardSizes.ts +4 -4
- package/src/common/card/specs/NsBrandCard.spec.tsx +5 -5
- package/src/common/card/stories/NsSmallFullCard.stories.tsx +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuskin/foundation-ui-components",
|
|
3
|
-
"version": "1.19.4
|
|
3
|
+
"version": "1.19.4",
|
|
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": {
|
|
@@ -1,18 +1,5 @@
|
|
|
1
|
-
import { Button } from '@mui/material';
|
|
2
1
|
import { NsButton, NsIcon } from '../';
|
|
3
2
|
import { NsCardButton } from './types';
|
|
4
|
-
import { styled } from '@nuskin/foundation-theme';
|
|
5
|
-
|
|
6
|
-
const ButtonTextVariant = styled(Button)(() => {
|
|
7
|
-
return {
|
|
8
|
-
padding: 0,
|
|
9
|
-
borderBottom: '1px solid black',
|
|
10
|
-
borderRadius: 0,
|
|
11
|
-
textTransform: 'none',
|
|
12
|
-
fontSize: '14px',
|
|
13
|
-
fontWeight: 600,
|
|
14
|
-
};
|
|
15
|
-
});
|
|
16
3
|
|
|
17
4
|
const CardButton = ({
|
|
18
5
|
url,
|
|
@@ -27,27 +14,21 @@ const CardButton = ({
|
|
|
27
14
|
if (showButton && url) {
|
|
28
15
|
return (
|
|
29
16
|
<div className="cta">
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
17
|
+
<NsButton
|
|
18
|
+
href={url}
|
|
19
|
+
color={buttonColor}
|
|
20
|
+
variant={buttonVariant}
|
|
21
|
+
fullWidth={fullWidth}
|
|
22
|
+
endIcon={
|
|
23
|
+
showArrowWithText && buttonVariant === 'text' ? (
|
|
34
24
|
<NsIcon name="arrowRight" size="small" color="primary" />
|
|
35
25
|
) : endIcon ? (
|
|
36
|
-
<NsIcon name={endIcon}
|
|
37
|
-
) : null
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
color={buttonColor}
|
|
43
|
-
variant={buttonVariant}
|
|
44
|
-
fullWidth={fullWidth}
|
|
45
|
-
endIcon={endIcon ? <NsIcon name={endIcon} color={buttonColor} /> : null}
|
|
46
|
-
className="cta-text"
|
|
47
|
-
>
|
|
48
|
-
{buttonText}
|
|
49
|
-
</NsButton>
|
|
50
|
-
)}
|
|
26
|
+
<NsIcon name={endIcon} color={buttonColor} />
|
|
27
|
+
) : null
|
|
28
|
+
}
|
|
29
|
+
>
|
|
30
|
+
{buttonText}
|
|
31
|
+
</NsButton>
|
|
51
32
|
</div>
|
|
52
33
|
);
|
|
53
34
|
}
|
|
@@ -19,18 +19,18 @@ type NsBrandCardProps = {
|
|
|
19
19
|
|
|
20
20
|
const CardContainer = styled((props: any) => <Box {...props} />)(({ size }) => {
|
|
21
21
|
const { small, large } = cardSizes;
|
|
22
|
-
let
|
|
22
|
+
let width, height;
|
|
23
23
|
|
|
24
24
|
if (size === 'small') {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
width = small.width;
|
|
26
|
+
height = small.height;
|
|
27
27
|
} else {
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
width = large.width;
|
|
29
|
+
height = large.height;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
return {
|
|
33
|
-
|
|
33
|
+
width,
|
|
34
34
|
display: 'flex',
|
|
35
35
|
alignItems: 'start',
|
|
36
36
|
justifyContent: 'center',
|
|
@@ -38,9 +38,6 @@ const CardContainer = styled((props: any) => <Box {...props} />)(({ size }) => {
|
|
|
38
38
|
flexDirection: 'column',
|
|
39
39
|
'.brand-title': {
|
|
40
40
|
marginTop: '15px',
|
|
41
|
-
fontSize: '18px',
|
|
42
|
-
fontWeight: 600,
|
|
43
|
-
lineHeight: '26px',
|
|
44
41
|
display: 'inline-block',
|
|
45
42
|
wordBreak: 'break-word',
|
|
46
43
|
},
|
|
@@ -49,9 +46,13 @@ const CardContainer = styled((props: any) => <Box {...props} />)(({ size }) => {
|
|
|
49
46
|
opacity: '0.7',
|
|
50
47
|
},
|
|
51
48
|
},
|
|
49
|
+
'.cta': {
|
|
50
|
+
marginTop: '15px',
|
|
51
|
+
width: '100%',
|
|
52
|
+
},
|
|
52
53
|
'.image': {
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
width,
|
|
55
|
+
height,
|
|
55
56
|
backgroundSize: 'cover',
|
|
56
57
|
backgroundPosition: 'center',
|
|
57
58
|
},
|
|
@@ -73,7 +74,7 @@ export default function NsBrandCard({
|
|
|
73
74
|
</NsBrandWrapper>
|
|
74
75
|
</NsBgCard>
|
|
75
76
|
{title ? (
|
|
76
|
-
<NsTypography variant="
|
|
77
|
+
<NsTypography weight='normal' variant="h5" className="brand-title">
|
|
77
78
|
{title}
|
|
78
79
|
</NsTypography>
|
|
79
80
|
) : null}
|
|
@@ -23,8 +23,8 @@ const CardContainer = styled((props: any) => <Box {...props} />)(({ imagePositio
|
|
|
23
23
|
wordWrap: 'break-word' as 'break-word',
|
|
24
24
|
position: 'relative',
|
|
25
25
|
overflow: 'hidden',
|
|
26
|
-
|
|
27
|
-
height: '
|
|
26
|
+
maxWidth: '820px',
|
|
27
|
+
height: '532px',
|
|
28
28
|
flexDirection: 'row',
|
|
29
29
|
'.content': {
|
|
30
30
|
width: '50%',
|
|
@@ -22,8 +22,8 @@ const CardContainer = styled(Box)(() => {
|
|
|
22
22
|
wordWrap: 'break-word' as 'break-word',
|
|
23
23
|
position: 'relative',
|
|
24
24
|
overflow: 'hidden',
|
|
25
|
-
height: '
|
|
26
|
-
|
|
25
|
+
height: '236px',
|
|
26
|
+
maxWidth: '536px',
|
|
27
27
|
'.content': {
|
|
28
28
|
height: '100%',
|
|
29
29
|
padding: '50px',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Box from '@mui/material/Box';
|
|
2
|
-
import { NsImage } from '../';
|
|
2
|
+
import { NsImage, NsTypography } from '../';
|
|
3
3
|
import { styled } from '@nuskin/foundation-theme';
|
|
4
4
|
|
|
5
5
|
type NsPostProps = {
|
|
@@ -18,40 +18,36 @@ const CardContainer = styled(Box)(() => {
|
|
|
18
18
|
wordWrap: 'break-word' as 'break-word',
|
|
19
19
|
position: 'relative',
|
|
20
20
|
overflow: 'hidden',
|
|
21
|
+
height: 'auto',
|
|
21
22
|
maxWidth: '165px',
|
|
22
|
-
height: '272px',
|
|
23
23
|
backgroundColor: '#fff',
|
|
24
|
-
'.image': {
|
|
25
|
-
height: '180px',
|
|
26
|
-
overflow: 'hidden',
|
|
27
|
-
objectFit: 'contain',
|
|
28
|
-
},
|
|
29
24
|
'.content': {
|
|
30
|
-
|
|
25
|
+
paddingTop: '10px',
|
|
31
26
|
display: 'flex',
|
|
32
27
|
flexDirection: 'column',
|
|
33
|
-
minHeight: '
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
minHeight: '80px',
|
|
29
|
+
justifyContent: 'space-between',
|
|
30
|
+
padding: '20px',
|
|
36
31
|
},
|
|
37
32
|
'.body-title': {
|
|
38
|
-
|
|
39
|
-
fontWeight: 600,
|
|
33
|
+
marginBottom: '5px',
|
|
40
34
|
display: '-webkit-box',
|
|
41
35
|
'-webkit-box-orient': 'vertical',
|
|
42
|
-
'-webkit-line-clamp': '
|
|
36
|
+
'-webkit-line-clamp': '3',
|
|
43
37
|
overflow: 'hidden',
|
|
44
38
|
textOverflow: 'ellipsis',
|
|
39
|
+
fontSize: '18px',
|
|
40
|
+
fontWeight: 600,
|
|
41
|
+
lineHeight: '22px',
|
|
42
|
+
fontFamily: 'Inter',
|
|
45
43
|
},
|
|
46
44
|
'.body-text': {
|
|
47
|
-
fontSize: '12px',
|
|
48
|
-
fontWeight: 700,
|
|
49
|
-
display: '-webkit-box',
|
|
50
|
-
'-webkit-box-orient': 'vertical',
|
|
51
|
-
'-webkit-line-clamp': '1',
|
|
52
|
-
overflow: 'hidden',
|
|
53
|
-
textOverflow: 'ellipsis',
|
|
54
45
|
color: '#8C8C8C',
|
|
46
|
+
margin: '0px',
|
|
47
|
+
fontSize: '16px',
|
|
48
|
+
fontWeight: 600,
|
|
49
|
+
lineHeight: '16px',
|
|
50
|
+
fontFamily: 'Inter',
|
|
55
51
|
},
|
|
56
52
|
};
|
|
57
53
|
});
|
|
@@ -60,11 +56,15 @@ const NsPost = ({ text, body, backgroundImageUrl, backgroundImageAlt, className
|
|
|
60
56
|
return (
|
|
61
57
|
<CardContainer className={className} data-testid="post-card">
|
|
62
58
|
<div className="image">
|
|
63
|
-
<NsImage height=
|
|
59
|
+
<NsImage height="auto" width="100%" alt={backgroundImageAlt} src={backgroundImageUrl} />
|
|
64
60
|
</div>
|
|
65
61
|
<div className="content">
|
|
66
|
-
<
|
|
67
|
-
|
|
62
|
+
<NsTypography weight="normal" className="body-title" variant="h5">
|
|
63
|
+
{text}
|
|
64
|
+
</NsTypography>
|
|
65
|
+
<NsTypography className="body-text" variant="body-l">
|
|
66
|
+
{body}
|
|
67
|
+
</NsTypography>
|
|
68
68
|
</div>
|
|
69
69
|
</CardContainer>
|
|
70
70
|
);
|
|
@@ -17,9 +17,8 @@ const CardContainer = styled(Box)(() => {
|
|
|
17
17
|
return {
|
|
18
18
|
backgroundColor: '#fff',
|
|
19
19
|
display: 'flex',
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
overflow: 'hidden',
|
|
20
|
+
height: '275px',
|
|
21
|
+
width: '250px',
|
|
23
22
|
position: 'relative',
|
|
24
23
|
'.image': {
|
|
25
24
|
width: '100%',
|
|
@@ -50,15 +49,12 @@ const CardContainer = styled(Box)(() => {
|
|
|
50
49
|
},
|
|
51
50
|
'.title': {
|
|
52
51
|
color: '#fff',
|
|
53
|
-
fontSize: '
|
|
52
|
+
fontSize: '22px',
|
|
54
53
|
fontWeight: '400',
|
|
55
54
|
marginTop: '20px',
|
|
56
55
|
},
|
|
57
56
|
'.cta': {
|
|
58
57
|
marginTop: '20px',
|
|
59
|
-
maxWidth: '208px',
|
|
60
|
-
borderRadius: '4px',
|
|
61
|
-
overflow: 'hidden',
|
|
62
58
|
},
|
|
63
59
|
};
|
|
64
60
|
});
|
|
@@ -58,11 +58,11 @@ describe('NsBrandCard component', () => {
|
|
|
58
58
|
const cardContainer = container.firstChild;
|
|
59
59
|
const nsBgCardElement = cardContainer?.firstChild;
|
|
60
60
|
expect(cardContainer).toHaveStyle(`
|
|
61
|
-
|
|
61
|
+
width: 180px;
|
|
62
62
|
`);
|
|
63
63
|
expect(nsBgCardElement).toHaveStyle(`
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
width: 180px;
|
|
65
|
+
height: 200px;
|
|
66
66
|
`);
|
|
67
67
|
});
|
|
68
68
|
|
|
@@ -71,7 +71,7 @@ describe('NsBrandCard component', () => {
|
|
|
71
71
|
const cardContainer = screen.getByTestId('brand-card') as HTMLElement;
|
|
72
72
|
const computedStyles = window.getComputedStyle(cardContainer);
|
|
73
73
|
|
|
74
|
-
expect(computedStyles.
|
|
74
|
+
expect(computedStyles.width).toBe('220px');
|
|
75
75
|
});
|
|
76
76
|
|
|
77
77
|
it('7. renders with default styles when size is not provided', () => {
|
|
@@ -79,6 +79,6 @@ describe('NsBrandCard component', () => {
|
|
|
79
79
|
const cardContainer = screen.getByTestId('brand-card') as HTMLElement;
|
|
80
80
|
const computedStyles = window.getComputedStyle(cardContainer);
|
|
81
81
|
|
|
82
|
-
expect(computedStyles.
|
|
82
|
+
expect(computedStyles.width).toBe('220px');
|
|
83
83
|
});
|
|
84
84
|
});
|