@nuskin/foundation-ui-components 1.9.1 → 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.
Files changed (40) hide show
  1. package/package.json +1 -1
  2. package/src/common/card/CardButton.tsx +31 -0
  3. package/src/common/card/NsAwardCard.tsx +4 -2
  4. package/src/common/card/NsBrandCard.tsx +7 -17
  5. package/src/common/card/NsCheckoutCard.tsx +8 -7
  6. package/src/common/card/NsHeroCardLevel1.tsx +17 -35
  7. package/src/common/card/NsHeroCardLevel2.tsx +20 -46
  8. package/src/common/card/NsIconText.tsx +4 -4
  9. package/src/common/card/NsLargeCard.tsx +15 -47
  10. package/src/common/card/NsMediumCard.tsx +10 -21
  11. package/src/common/card/NsPost.tsx +5 -5
  12. package/src/common/card/NsSmallFullCard.tsx +10 -19
  13. package/src/common/card/NsXLargeCard.tsx +10 -9
  14. package/src/common/card/specs/NsAwardCard.spec.tsx +29 -0
  15. package/src/common/card/specs/NsBrandCard.spec.tsx +13 -26
  16. package/src/common/card/specs/NsCheckoutCard.spec.tsx +4 -15
  17. package/src/common/card/specs/NsHeroCardLevel1.spec.tsx +16 -24
  18. package/src/common/card/specs/NsHeroCardLevel2.spec.tsx +18 -20
  19. package/src/common/card/specs/NsIconText.spec.tsx +0 -3
  20. package/src/common/card/specs/NsLargeCard.spec.tsx +26 -19
  21. package/src/common/card/specs/NsMediumCard.spec.tsx +28 -12
  22. package/src/common/card/specs/NsPost.spec.tsx +8 -11
  23. package/src/common/card/specs/NsSmallFullCard.spec.tsx +23 -12
  24. package/src/common/card/specs/NsXLargeCard.spec.tsx +23 -11
  25. package/src/common/card/stories/NsAwardCard.stories.tsx +0 -3
  26. package/src/common/card/stories/NsBrandCard.stories.tsx +7 -3
  27. package/src/common/card/stories/NsCheckoutCard.stories.tsx +3 -4
  28. package/src/common/card/stories/NsHeroCardLevel1.stories.tsx +10 -24
  29. package/src/common/card/stories/NsHeroCardLevel2.stories.tsx +10 -29
  30. package/src/common/card/stories/NsIconText.stories.tsx +2 -20
  31. package/src/common/card/stories/NsLargeCard.stories.tsx +8 -7
  32. package/src/common/card/stories/NsMediumCard.stories.tsx +7 -6
  33. package/src/common/card/stories/NsPost.stories.tsx +2 -19
  34. package/src/common/card/stories/NsSmallFullCard.stories.tsx +7 -4
  35. package/src/common/card/stories/NsXLargeCard.stories.tsx +8 -4
  36. package/src/common/card/types.d.ts +12 -0
  37. package/src/common/carousal/CarousalControl.tsx +10 -6
  38. package/src/common/carousal/NsCarousal.tsx +15 -3
  39. package/src/common/carousal/RenderBrand.tsx +0 -1
  40. package/src/common/carousal/stories/NSCarousal.stories.tsx +7 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/foundation-ui-components",
3
- "version": "1.9.1",
3
+ "version": "1.9.3",
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": {
@@ -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?: boolean;
17
- onClick?: () => void;
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
- onClick,
67
+ className,
68
68
  }: NsBrandCardProps) {
69
69
  return (
70
- <CardContainer role="brand-card" component="div" data-testid="brand-card" size={size} onClick={onClick}>
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
- address: string;
10
- onClick: () => void;
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, address, icon, onClick }: NsCheckoutCardProps) {
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" onClick={onClick}>
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">{address}</article>
77
- <NsLink className="action-link" href={''}>
78
- CHANGE
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 { NsLink, NsImage } from '../';
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
- text: string;
8
- body: string;
9
- cardLink: { href: string; title: string };
8
+ cardTitle: string;
9
+ cardDescription: string;
10
10
  backgroundImageUrl: string;
11
11
  backgroundImageAlt: string;
12
- onClick: () => void;
13
- } & AdditionalProps;
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', // https://github.com/cssinjs/jss/issues/1344
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
- text,
84
- body,
85
- cardLink,
68
+ cardTitle,
69
+ cardDescription,
86
70
  backgroundImageUrl,
87
71
  backgroundImageAlt,
88
- onClick,
89
- additionalProps,
72
+ button,
73
+ className,
90
74
  }: NsHeroCardLevel1Props) => {
91
75
  return (
92
- <CardContainer data-testid={additionalProps?.testid} onClick={onClick}>
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">{text}</article>
98
- <article className="body-text">{body}</article>
99
- <NsLink className="action-link" href={cardLink.href}>
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 { NsLink, NsImage, NsIcon, NsIconNameType } from '../';
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
- brand: string;
8
- text: string;
9
- body: string;
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
- onClick: () => void;
15
- } & AdditionalProps;
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', // https://github.com/cssinjs/jss/issues/1344
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
- brand,
96
- text,
97
- body,
98
- cardLink,
76
+ brandName,
77
+ cardTitle,
78
+ cardDescription,
99
79
  backgroundImageUrl,
100
80
  backgroundImageAlt,
101
- additionalProps,
102
- icon,
103
- onClick,
81
+ button,
82
+ className,
104
83
  }: NsHeroCardLevel2Props) => {
105
84
  return (
106
- <CardContainer data-testid={additionalProps?.testid} onClick={onClick}>
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>{brand}</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
- } & AdditionalProps;
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, additionalProps }: NsIconTextProps) => {
45
+ const NsIconText = ({ text, body, className }: NsIconTextProps) => {
46
46
  return (
47
- <CardContainer data-testid={additionalProps?.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 { NsButton, NsIcon, NsImage, NsLink, NsIconNameType } from '..';
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 role="large-card" component="div" data-testid="large-card" isHorizontal={isHorizontal}>
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
- {isHorizontal ? (
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 { NsButton, NsIcon, NsIconNameType, NsImage, NsTypography } from '..';
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
- buttonVariant: 'text' | 'outlined' | 'contained';
13
- cardLink: { href: string; title: string };
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
- '.action-link': {
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
- cardLink,
55
- icon,
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
- <NsButton
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
- } & AdditionalProps;
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', // https://github.com/cssinjs/jss/issues/1344
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, additionalProps }: NsPostProps) => {
44
+ const NsPost = ({ text, body, backgroundImageUrl, backgroundImageAlt, className }: NsPostProps) => {
45
45
  return (
46
- <CardContainer data-testid={additionalProps?.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, NsLink } from '../';
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
- cardLink: { href: string; title: string };
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
- '.action-link': {
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
- cardLink,
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
- <NsLink className="action-link" href={cardLink.href}>
85
- {cardLink.title}
86
- </NsLink>
77
+ {button ? <CardButton {...button} /> : null}
87
78
  </div>
88
79
  </CardContainer>
89
80
  );