@nuskin/foundation-ui-components 1.29.1 → 1.30.0
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 -7
- package/src/common/accordion/NsAccordion.tsx +2 -2
- package/src/common/accordion/NsAccordionHeader.tsx +2 -9
- package/src/common/accordion/NsAccordionItem.tsx +4 -3
- package/src/common/accordion/NsCollapse.tsx +1 -1
- package/src/common/accordion/NsToggleSection.tsx +10 -3
- package/src/common/accordion/stories/NsAccordionItem.stories.tsx +5 -3
- package/src/common/accordion/stories/NsCollapse.stories.tsx +5 -3
- package/src/common/alert/NsAlert.stories.tsx +6 -4
- package/src/common/alert/NsAlert.tsx +27 -13
- package/src/common/auth-dropdown/NsAuthDropdown.tsx +7 -7
- package/src/common/autocomplete/NsAutocomplete.spec.tsx +3 -3
- package/src/common/autocomplete/NsAutocomplete.tsx +2 -1
- package/src/common/autocomplete/helper/SeeMoreButton.tsx +2 -2
- package/src/common/autocomplete/helper/renderGroupName.tsx +4 -3
- package/src/common/autocomplete/stories/NsAutocomplete.stories.tsx +9 -9
- package/src/common/banner/NsBanner.spec.tsx +5 -5
- package/src/common/banner/NsBanner.stories.tsx +8 -5
- package/src/common/banner/NsBanner.tsx +10 -20
- package/src/common/banner/types.d.ts +2 -2
- package/src/common/brand-components/NsBrandComponent.tsx +6 -3
- package/src/common/brand-components/icons/NSLogoHorizontal.tsx +7 -2
- package/src/common/brand-components/icons/NSLogoMark.tsx +3 -1
- package/src/common/brand-components/icons/NSLogoPoweredBy.tsx +4 -2
- package/src/common/brand-components/icons/NSLogoStacked.tsx +4 -2
- package/src/common/brand-components/icons/NSWordMark.tsx +4 -2
- package/src/common/breadcrumb/NsBreadcrumb.tsx +20 -5
- package/src/common/button/NsButton.stories.tsx +14 -8
- package/src/common/button/NsButton.tsx +7 -4
- package/src/common/card/CardButton.tsx +4 -3
- package/src/common/card/NsAwardCard.tsx +9 -8
- package/src/common/card/NsBgCard.tsx +1 -0
- package/src/common/card/NsBrandCard.tsx +8 -5
- package/src/common/card/NsBrandWrapper.tsx +3 -2
- package/src/common/card/NsCheckoutCard.tsx +4 -2
- package/src/common/card/NsHeroCardLevel1.tsx +9 -9
- package/src/common/card/NsHeroCardLevel2.tsx +9 -9
- package/src/common/card/NsIconText.tsx +3 -2
- package/src/common/card/NsLargeCard.tsx +9 -9
- package/src/common/card/NsMediumCard.tsx +10 -9
- package/src/common/card/NsPost.tsx +7 -8
- package/src/common/card/NsSmallFullCard.tsx +9 -9
- package/src/common/card/NsXLargeCard.tsx +9 -9
- 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/carousal/CarousalControl.tsx +5 -2
- package/src/common/carousal/IconWrapper.tsx +4 -3
- package/src/common/carousal/NsCarousal.tsx +8 -6
- package/src/common/carousal/NsScrollingCarousal.tsx +2 -2
- package/src/common/carousal/RenderBrand.tsx +3 -1
- package/src/common/carousal/specs/NsScrollingCarousal.spec.tsx +4 -2
- package/src/common/carousal/stories/{NSCarousal.stories.tsx → NsCarousal1.stories.tsx} +5 -2
- package/src/common/carousal/stories/NsScrollingCarousal.stories.tsx +4 -2
- package/src/common/cart-icon/NsCartIcon.tsx +9 -1
- package/src/common/checkbox/NsCheckbox.stories.tsx +5 -4
- package/src/common/checkbox/NsCheckbox.tsx +6 -6
- package/src/common/column-control/NsColumnControl.tsx +5 -3
- package/src/common/column-control/NsFlexColumns.tsx +10 -3
- package/src/common/column-control/NsGridColumns.tsx +10 -3
- package/src/common/column-control/stories/NsColumnControl.stories.tsx +8 -5
- package/src/common/column-control/stories/NsFlexColumns.stories.tsx +9 -6
- package/src/common/column-control/stories/NsGridColumns.stories.tsx +19 -7
- package/src/common/column-control/styled/common.ts +1 -1
- package/src/common/dropdown/NsDropdown.tsx +6 -6
- package/src/common/dropdown/NsDropdownOption.tsx +4 -3
- package/src/common/dropdown/stories/NsDropdown.stories.tsx +5 -3
- package/src/common/email-simple/NsEmailSimple.tsx +4 -3
- package/src/common/flag/NsFlag.tsx +3 -2
- package/src/common/hooks/useAccordionMap.tsx +1 -1
- package/src/common/icon/NsIcon.tsx +2 -5
- package/src/common/icon/icons/AlertErrorIcon.tsx +3 -1
- package/src/common/icon/icons/ArrowDown.tsx +7 -2
- package/src/common/icon/icons/ArrowLeft.tsx +7 -2
- package/src/common/icon/icons/ArrowRight.tsx +7 -2
- package/src/common/icon/icons/ArrowUp.tsx +4 -2
- package/src/common/icon/icons/Cart.tsx +7 -2
- package/src/common/icon/icons/CartBadge.tsx +7 -2
- package/src/common/icon/icons/Check.tsx +7 -2
- package/src/common/icon/icons/CheckShield.tsx +4 -2
- package/src/common/icon/icons/CheckVerified.tsx +7 -2
- package/src/common/icon/icons/ChevronRight.tsx +9 -4
- package/src/common/icon/icons/CloseIcon.tsx +7 -2
- package/src/common/icon/icons/ErrorIcon.tsx +3 -1
- package/src/common/icon/icons/HamburgerIcon.tsx +4 -1
- package/src/common/icon/icons/InfoFilled.tsx +7 -2
- package/src/common/icon/icons/InfoOutlined.tsx +7 -2
- package/src/common/icon/icons/RoundedClose.tsx +7 -2
- package/src/common/icon/icons/SearchIcon.tsx +3 -1
- package/src/common/icon/icons/SlashIcon.tsx +7 -2
- package/src/common/icon/icons/SuccessIcon.tsx +3 -1
- package/src/common/icon/icons/TrashIcon.tsx +3 -1
- package/src/common/icon/icons/UserIcon.tsx +4 -1
- package/src/common/icon/icons/UserOutline.tsx +3 -1
- package/src/common/icon/icons/WarningIcon.tsx +3 -1
- package/src/common/icon/icons/home.tsx +4 -2
- package/src/common/image/BynderMedia.spec.tsx +42 -0
- package/src/common/image/BynderMedia.tsx +48 -0
- package/src/common/image/NsImage.tsx +3 -3
- package/src/common/image/NsNextImage.tsx +5 -2
- 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/input/InputWrapper.tsx +2 -1
- package/src/common/input/NsInputField.tsx +11 -3
- package/src/common/label/NsLabel.tsx +9 -4
- package/src/common/link/NsLink.stories.tsx +9 -5
- package/src/common/link/NsLink.tsx +9 -3
- package/src/common/modal/NsModal.tsx +2 -2
- package/src/common/modal/helper-component/NsModalContentBox.tsx +8 -3
- package/src/common/modal/helper-component/NsModalDefault.tsx +9 -2
- package/src/common/modal/helper-component/NsModalStatus.tsx +3 -1
- package/src/common/modal/helper-component/NsModalStatusIcon.tsx +2 -2
- package/src/common/modal/helper-component/NsModalTitle.tsx +6 -3
- package/src/common/modal/stories/NsModal.stories.tsx +9 -7
- package/src/common/nav-product-card/NsNavProductCard.spec.tsx +3 -5
- package/src/common/nav-product-card/NsNavProductCard.stories.tsx +4 -4
- package/src/common/nav-product-card/NsNavProductCard.tsx +6 -6
- package/src/common/nav-product-card/types.d.ts +2 -1
- package/src/common/nav-tab/NavDrawer.tsx +10 -3
- package/src/common/nav-tab/NavTitles.tsx +2 -2
- package/src/common/nav-tab/NsNavTab.tsx +10 -4
- package/src/common/progress/NsProgress.stories.tsx +6 -3
- package/src/common/progress/NsProgress.tsx +3 -3
- package/src/common/radiogroup/NsRadioGroup.tsx +4 -2
- package/src/common/search-bar/NsSearchBar.tsx +3 -2
- package/src/common/select/DefaultRenderOption.tsx +3 -1
- package/src/common/select/NsSelect.tsx +19 -6
- package/src/common/select/NsSelectOption.tsx +2 -2
- package/src/common/select/stories/NsSelect.stories.tsx +5 -4
- package/src/common/spinner/NsSpinner.stories.tsx +5 -2
- package/src/common/spinner/NsSpinner.tsx +3 -2
- package/src/common/spinner/icons/Spinner.tsx +3 -1
- package/src/common/table/NsExpandableRow.tsx +35 -41
- package/src/common/table/NsTable.stories.tsx +17 -23
- package/src/common/table/NsTable.tsx +27 -10
- package/src/common/table/NsTableHeader.tsx +18 -5
- package/src/common/table/NsTablePagination.tsx +7 -11
- package/src/common/text-strip/NsTextStrip.tsx +6 -3
- package/src/common/toast/Fade.tsx +5 -8
- package/src/common/toast/ToastProvider.tsx +18 -17
- package/src/common/toast/specs/Toast.spec.tsx +56 -64
- package/src/common/toast/stories/Toast.stories.tsx +12 -11
- package/src/common/typography/GlobalFontInter.tsx +7 -2
- package/src/common/typography/NsTypography.tsx +11 -4
- package/src/common/videos/NsVideo.tsx +5 -2
- package/src/common/image/types.d.ts +0 -30
|
@@ -4,17 +4,32 @@
|
|
|
4
4
|
* @description NsBreadcrumb component with a navigation items array props
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
PropsWithChildren,
|
|
9
|
+
ReactElement,
|
|
10
|
+
} from 'react';
|
|
8
11
|
|
|
9
|
-
import { BreadcrumbContainer, BreadcrumbItem, BreadcrumbList, BreadcrumbStyledLink } from './NsBreadcrumb.styled';
|
|
10
|
-
import { NsTypography, NsIcon } from '../';
|
|
11
|
-
import { NsBreadcrumbProps, ItemProps } from './types.d';
|
|
12
12
|
import { useTheme } from '@mui/material/styles';
|
|
13
13
|
import { ColorUtils } from '@nuskin/foundation-theme';
|
|
14
14
|
|
|
15
|
+
import {
|
|
16
|
+
NsIcon,
|
|
17
|
+
NsTypography,
|
|
18
|
+
} from '../';
|
|
19
|
+
import {
|
|
20
|
+
BreadcrumbContainer,
|
|
21
|
+
BreadcrumbItem,
|
|
22
|
+
BreadcrumbList,
|
|
23
|
+
BreadcrumbStyledLink,
|
|
24
|
+
} from './NsBreadcrumb.styled';
|
|
25
|
+
import {
|
|
26
|
+
ItemProps,
|
|
27
|
+
NsBreadcrumbProps,
|
|
28
|
+
} from './types.d';
|
|
29
|
+
|
|
15
30
|
const { color } = ColorUtils;
|
|
16
31
|
|
|
17
|
-
const NsBreadcrumb = (props: PropsWithChildren<NsBreadcrumbProps>) => {
|
|
32
|
+
const NsBreadcrumb = (props: PropsWithChildren<NsBreadcrumbProps>):ReactElement => {
|
|
18
33
|
const { items, underline = true, separator = 'chevronRight' } = props;
|
|
19
34
|
|
|
20
35
|
const theme = useTheme();
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { NsButton } from './';
|
|
4
|
-
import { ShoppingCart } from '@mui/icons-material';
|
|
1
|
+
import React, { ReactElement } from 'react';
|
|
2
|
+
|
|
5
3
|
import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
|
|
6
|
-
import {
|
|
7
|
-
import { expect } from '@storybook/jest';
|
|
4
|
+
import { ShoppingCart } from '@mui/icons-material';
|
|
8
5
|
import { nuskinTheme } from '@nuskin/foundation-theme';
|
|
6
|
+
import { expect } from '@storybook/jest';
|
|
7
|
+
import type {
|
|
8
|
+
Meta,
|
|
9
|
+
StoryObj,
|
|
10
|
+
} from '@storybook/react';
|
|
11
|
+
import { within } from '@storybook/testing-library';
|
|
12
|
+
|
|
13
|
+
import { NsButton } from './';
|
|
14
|
+
|
|
9
15
|
const { palette } = nuskinTheme;
|
|
10
16
|
|
|
11
17
|
type ComponentType = typeof NsButton;
|
|
@@ -44,7 +50,7 @@ export const button: Story = {
|
|
|
44
50
|
};
|
|
45
51
|
|
|
46
52
|
export const IconOnlyButton: Story = {
|
|
47
|
-
render: (args: any) => (
|
|
53
|
+
render: (args: any):ReactElement => (
|
|
48
54
|
<NsButton {...args} iconOnly darkModeEnabled={false}>
|
|
49
55
|
<ShoppingCart />
|
|
50
56
|
</NsButton>
|
|
@@ -62,7 +68,7 @@ export const IconOnlyButton: Story = {
|
|
|
62
68
|
},
|
|
63
69
|
};
|
|
64
70
|
export const ButtonWithIcon: Story = {
|
|
65
|
-
render: (args: any) => (
|
|
71
|
+
render: (args: any):ReactElement => (
|
|
66
72
|
<NsButton {...args} darkModeEnabled={false} startIcon={<ShoppingCart />}>
|
|
67
73
|
Add to Cart
|
|
68
74
|
</NsButton>
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
PropsWithChildren,
|
|
3
|
+
ReactElement,
|
|
4
|
+
} from 'react';
|
|
5
|
+
|
|
2
6
|
import { useTheme } from '@mui/material/styles';
|
|
3
7
|
|
|
8
|
+
import { NsIcon } from '../icon';
|
|
4
9
|
import { StyledButton } from './NsButton.styled';
|
|
5
|
-
|
|
6
10
|
import { NsButtonProps } from './types.d';
|
|
7
|
-
import { NsIcon } from '../icon';
|
|
8
11
|
|
|
9
|
-
const NsButton = ({ children, darkModeEnabled = true, ...props }: PropsWithChildren<NsButtonProps>) => {
|
|
12
|
+
const NsButton = ({ children, darkModeEnabled = true, ...props }: PropsWithChildren<NsButtonProps>):ReactElement => {
|
|
10
13
|
const { color, startIconName, endIconName, variant } = props;
|
|
11
14
|
const { palette } = useTheme();
|
|
12
15
|
// TODO: remove any
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
|
|
2
3
|
import { Button } from '@mui/material';
|
|
3
4
|
import { styled } from '@nuskin/foundation-theme';
|
|
4
|
-
import { ReactNode } from 'react';
|
|
5
5
|
|
|
6
6
|
import { NsButton, NsIcon } from '../';
|
|
7
|
+
import { NsCardButton } from './types';
|
|
7
8
|
|
|
8
9
|
const ButtonTextVariant = styled(Button)(() => {
|
|
9
10
|
return {
|
|
@@ -25,7 +26,7 @@ const CardButton = ({
|
|
|
25
26
|
buttonColor = 'primary',
|
|
26
27
|
fullWidth = false,
|
|
27
28
|
showArrowWithText = false,
|
|
28
|
-
}: NsCardButton):
|
|
29
|
+
}: NsCardButton): ReactElement | null => {
|
|
29
30
|
if (showButton && url) {
|
|
30
31
|
return (
|
|
31
32
|
<div className="cta">
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
|
|
1
3
|
import Box from '@mui/material/Box';
|
|
2
4
|
import { styled } from '@nuskin/foundation-theme';
|
|
3
|
-
import { ReactNode } from 'react';
|
|
4
5
|
|
|
5
|
-
import {
|
|
6
|
+
import { NsTypography } from '../';
|
|
7
|
+
import { BynderMedia } from '../image/BynderMedia';
|
|
8
|
+
import { BynderImageDataType } from '../image/types';
|
|
6
9
|
|
|
7
10
|
type NsAwardCardProps = {
|
|
8
11
|
title: string;
|
|
9
12
|
awardName: string;
|
|
10
13
|
mediaOutlet: string;
|
|
11
|
-
|
|
12
|
-
backgroundImageAlt: string;
|
|
14
|
+
backgroundImageDetail: BynderImageDataType;
|
|
13
15
|
className?: string;
|
|
14
16
|
};
|
|
15
17
|
|
|
@@ -47,13 +49,12 @@ export default function NsAwardCard({
|
|
|
47
49
|
title,
|
|
48
50
|
awardName,
|
|
49
51
|
mediaOutlet,
|
|
50
|
-
|
|
51
|
-
backgroundImageAlt,
|
|
52
|
+
backgroundImageDetail,
|
|
52
53
|
className,
|
|
53
|
-
}: NsAwardCardProps):
|
|
54
|
+
}: NsAwardCardProps): ReactElement {
|
|
54
55
|
return (
|
|
55
56
|
<CardContainer className={className} role="award-card" component="div" data-testid="award-card">
|
|
56
|
-
<
|
|
57
|
+
<BynderMedia className="image" imageDetail={backgroundImageDetail} />
|
|
57
58
|
<div className="content">
|
|
58
59
|
<NsTypography weight="normal" className="title" variant="h5">
|
|
59
60
|
{title}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
|
|
1
3
|
import Box from '@mui/material/Box';
|
|
2
4
|
import { styled } from '@nuskin/foundation-theme';
|
|
5
|
+
|
|
3
6
|
import { NsTypography } from '../';
|
|
4
|
-
import NsBrandWrapper from './NsBrandWrapper';
|
|
5
|
-
import NsBrandLogo from './NsBrandLogo';
|
|
6
|
-
import NsBgCard from './NsBgCard';
|
|
7
|
-
import cardSizes from './cardSizes';
|
|
8
7
|
import CardButton from './CardButton';
|
|
8
|
+
import cardSizes from './cardSizes';
|
|
9
|
+
import NsBgCard from './NsBgCard';
|
|
10
|
+
import NsBrandLogo from './NsBrandLogo';
|
|
11
|
+
import NsBrandWrapper from './NsBrandWrapper';
|
|
9
12
|
import { NsCardButton } from './types';
|
|
10
13
|
|
|
11
14
|
type NsBrandCardProps = {
|
|
@@ -64,7 +67,7 @@ export default function NsBrandCard({
|
|
|
64
67
|
button,
|
|
65
68
|
size,
|
|
66
69
|
className,
|
|
67
|
-
}: NsBrandCardProps) {
|
|
70
|
+
}: NsBrandCardProps): ReactElement {
|
|
68
71
|
return (
|
|
69
72
|
<CardContainer className={className} role="brand-card" component="div" data-testid="brand-card" size={size}>
|
|
70
73
|
<NsBgCard backgroundImageUrl={backgroundImageUrl} className="image">
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { PropsWithChildren, ReactElement } from 'react';
|
|
2
|
+
|
|
1
3
|
import Box from '@mui/material/Box';
|
|
2
|
-
import { PropsWithChildren } from 'react';
|
|
3
4
|
import { styled } from '@nuskin/foundation-theme';
|
|
4
5
|
|
|
5
6
|
const Wrapper = styled(Box)(() => {
|
|
@@ -21,6 +22,6 @@ const Wrapper = styled(Box)(() => {
|
|
|
21
22
|
};
|
|
22
23
|
});
|
|
23
24
|
|
|
24
|
-
export default function NsBrandWrapper({ children }: PropsWithChildren) {
|
|
25
|
+
export default function NsBrandWrapper({ children }: PropsWithChildren): ReactElement {
|
|
25
26
|
return <Wrapper className="logo-wrapper">{children}</Wrapper>;
|
|
26
27
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { ReactElement, useState } from 'react';
|
|
2
|
+
|
|
1
3
|
import Box from '@mui/material/Box';
|
|
2
4
|
import { styled } from '@nuskin/foundation-theme';
|
|
5
|
+
|
|
3
6
|
import { NsIcon, NsIconNameType, NsLink } from '../';
|
|
4
|
-
import { useState } from 'react';
|
|
5
7
|
|
|
6
8
|
type NsCheckoutCardProps = {
|
|
7
9
|
icon: NsIconNameType;
|
|
@@ -59,7 +61,7 @@ const CardContainer = styled(Box)(() => {
|
|
|
59
61
|
};
|
|
60
62
|
});
|
|
61
63
|
|
|
62
|
-
export default function NsCheckoutCard({ title, icon, linkText, url, className }: NsCheckoutCardProps) {
|
|
64
|
+
export default function NsCheckoutCard({ title, icon, linkText, url, className }: NsCheckoutCardProps): ReactElement {
|
|
63
65
|
const [dropdownIcon, setDropdownIcon] = useState(false);
|
|
64
66
|
const handleClick = () => {
|
|
65
67
|
setDropdownIcon(!dropdownIcon);
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
|
|
2
3
|
import Box from '@mui/material/Box';
|
|
3
4
|
import { styled } from '@nuskin/foundation-theme';
|
|
4
|
-
import { ReactNode } from 'react';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { BynderMedia } from '../image/BynderMedia';
|
|
7
|
+
import { BynderImageDataType } from '../image/types';
|
|
7
8
|
import CardButton from './CardButton';
|
|
9
|
+
import { NsCardButton } from './types';
|
|
8
10
|
|
|
9
11
|
type NsHeroCardLevel1Props = {
|
|
10
12
|
cardTitle: string;
|
|
11
13
|
cardDescription: string;
|
|
12
|
-
|
|
13
|
-
backgroundImageAlt: string;
|
|
14
|
+
backgroundImageDetail: BynderImageDataType;
|
|
14
15
|
button?: NsCardButton;
|
|
15
16
|
className?: string;
|
|
16
17
|
imagePosition?: 'top' | 'bottom';
|
|
@@ -78,15 +79,14 @@ const CardContainer = styled((props: any) => <Box {...props} />)(({ imagePositio
|
|
|
78
79
|
export default function NsHeroCardLevel1({
|
|
79
80
|
cardTitle,
|
|
80
81
|
cardDescription,
|
|
81
|
-
|
|
82
|
-
backgroundImageAlt,
|
|
82
|
+
backgroundImageDetail,
|
|
83
83
|
button,
|
|
84
84
|
className,
|
|
85
85
|
imagePosition = 'top',
|
|
86
|
-
}: NsHeroCardLevel1Props):
|
|
86
|
+
}: NsHeroCardLevel1Props): ReactElement {
|
|
87
87
|
return (
|
|
88
88
|
<CardContainer className={className} data-testid="hero-card-level-1" imagePosition={imagePosition}>
|
|
89
|
-
<
|
|
89
|
+
<BynderMedia className="bg-image" imageDetail={backgroundImageDetail} />
|
|
90
90
|
<div className="content">
|
|
91
91
|
<article className="body-title">{cardTitle}</article>
|
|
92
92
|
<article className="body-text">{cardDescription}</article>
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
|
|
2
3
|
import Box from '@mui/material/Box';
|
|
3
4
|
import { styled } from '@nuskin/foundation-theme';
|
|
4
|
-
import { ReactNode } from 'react';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { BynderMedia } from '../image/BynderMedia';
|
|
7
|
+
import { BynderImageDataType } from '../image/types';
|
|
7
8
|
import CardButton from './CardButton';
|
|
9
|
+
import { NsCardButton } from './types';
|
|
8
10
|
|
|
9
11
|
type NsHeroCardLevel2Props = {
|
|
10
12
|
brandName: string;
|
|
11
13
|
cardTitle: string;
|
|
12
14
|
cardDescription: string;
|
|
13
|
-
|
|
14
|
-
backgroundImageAlt: string;
|
|
15
|
+
backgroundImageDetail: BynderImageDataType;
|
|
15
16
|
button?: NsCardButton;
|
|
16
17
|
className?: string;
|
|
17
18
|
};
|
|
@@ -67,14 +68,13 @@ const NsHeroCardLevel2 = ({
|
|
|
67
68
|
brandName,
|
|
68
69
|
cardTitle,
|
|
69
70
|
cardDescription,
|
|
70
|
-
|
|
71
|
-
backgroundImageAlt,
|
|
71
|
+
backgroundImageDetail,
|
|
72
72
|
button,
|
|
73
73
|
className,
|
|
74
|
-
}: NsHeroCardLevel2Props):
|
|
74
|
+
}: NsHeroCardLevel2Props): ReactElement => {
|
|
75
75
|
return (
|
|
76
76
|
<CardContainer className={className} data-testid="hero-card-level-2">
|
|
77
|
-
<
|
|
77
|
+
<BynderMedia className="bg-image" imageDetail={backgroundImageDetail} />
|
|
78
78
|
<div className="content">
|
|
79
79
|
<div className="brand-container">
|
|
80
80
|
<article>{brandName}</article>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
|
|
1
3
|
import Box from '@mui/material/Box';
|
|
2
4
|
import { styled } from '@nuskin/foundation-theme';
|
|
3
|
-
import { ReactNode } from 'react';
|
|
4
5
|
|
|
5
6
|
type NsIconTextProps = {
|
|
6
7
|
text: string;
|
|
@@ -43,7 +44,7 @@ const CardContainer = styled(Box)(() => {
|
|
|
43
44
|
};
|
|
44
45
|
});
|
|
45
46
|
|
|
46
|
-
const Icon = ():
|
|
47
|
+
const Icon = (): ReactElement => {
|
|
47
48
|
return (
|
|
48
49
|
<div className="icon">
|
|
49
50
|
<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 80 80" fill="none">
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
|
|
2
3
|
import Box from '@mui/material/Box';
|
|
3
4
|
import { styled } from '@nuskin/foundation-theme';
|
|
4
|
-
import { ReactNode } from 'react';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { BynderMedia } from '../image/BynderMedia';
|
|
7
|
+
import { BynderImageDataType } from '../image/types';
|
|
7
8
|
import CardButton from './CardButton';
|
|
9
|
+
import { NsCardButton } from './types';
|
|
8
10
|
|
|
9
11
|
type NsLargeCardProps = {
|
|
10
12
|
title: string;
|
|
11
13
|
subtitle?: string;
|
|
12
14
|
intro: string;
|
|
13
|
-
|
|
14
|
-
backgroundImageAlt: string;
|
|
15
|
+
backgroundImageDetail: BynderImageDataType;
|
|
15
16
|
isHorizontal?: boolean;
|
|
16
17
|
button?: NsCardButton;
|
|
17
18
|
className?: string;
|
|
@@ -73,13 +74,12 @@ const CardContainer = styled((props: any) => <Box {...props} />)(({ isHorizontal
|
|
|
73
74
|
export default function NsLargeCard({
|
|
74
75
|
title,
|
|
75
76
|
subtitle,
|
|
76
|
-
|
|
77
|
-
backgroundImageAlt,
|
|
77
|
+
backgroundImageDetail,
|
|
78
78
|
intro,
|
|
79
79
|
isHorizontal,
|
|
80
80
|
button,
|
|
81
81
|
className,
|
|
82
|
-
}: NsLargeCardProps):
|
|
82
|
+
}: NsLargeCardProps): ReactElement {
|
|
83
83
|
return (
|
|
84
84
|
<CardContainer
|
|
85
85
|
className={className}
|
|
@@ -88,7 +88,7 @@ export default function NsLargeCard({
|
|
|
88
88
|
data-testid="large-card"
|
|
89
89
|
isHorizontal={isHorizontal}
|
|
90
90
|
>
|
|
91
|
-
<
|
|
91
|
+
<BynderMedia className="bg-image" imageDetail={backgroundImageDetail} />
|
|
92
92
|
<div className="content">
|
|
93
93
|
<article className="subtitle">{subtitle}</article>
|
|
94
94
|
<article className="title">{title}</article>
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
|
|
2
3
|
import Box from '@mui/material/Box';
|
|
3
4
|
import { styled } from '@nuskin/foundation-theme';
|
|
4
|
-
import { ReactNode } from 'react';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { NsTypography } from '../';
|
|
7
|
+
import { BynderMedia } from '../image/BynderMedia';
|
|
8
|
+
import { BynderImageDataType } from '../image/types';
|
|
7
9
|
import CardButton from './CardButton';
|
|
10
|
+
import { NsCardButton } from './types';
|
|
8
11
|
|
|
9
12
|
type NsMediumCardProps = {
|
|
10
13
|
title: string;
|
|
11
14
|
titleFontWeight?: 'bold' | 'normal' | 'light';
|
|
12
15
|
subtitle: string;
|
|
13
|
-
|
|
14
|
-
backgroundImageAlt: string;
|
|
16
|
+
backgroundImageDetail: BynderImageDataType;
|
|
15
17
|
button?: NsCardButton;
|
|
16
18
|
className?: string;
|
|
17
19
|
fluid?: boolean;
|
|
@@ -72,13 +74,12 @@ export default function NsMediumCard({
|
|
|
72
74
|
title,
|
|
73
75
|
titleFontWeight,
|
|
74
76
|
subtitle,
|
|
75
|
-
|
|
76
|
-
backgroundImageAlt,
|
|
77
|
+
backgroundImageDetail,
|
|
77
78
|
button,
|
|
78
79
|
className,
|
|
79
80
|
fluid,
|
|
80
81
|
showArrowWithButtonText = false,
|
|
81
|
-
}: NsMediumCardProps):
|
|
82
|
+
}: NsMediumCardProps): ReactElement {
|
|
82
83
|
return (
|
|
83
84
|
<CardContainer
|
|
84
85
|
className={className}
|
|
@@ -88,7 +89,7 @@ export default function NsMediumCard({
|
|
|
88
89
|
fluid={fluid || false}
|
|
89
90
|
variant={button?.buttonVariant ?? ''}
|
|
90
91
|
>
|
|
91
|
-
<
|
|
92
|
+
<BynderMedia className="image" imageDetail={backgroundImageDetail} />
|
|
92
93
|
<div className="content">
|
|
93
94
|
<NsTypography variant="h5" color="primary" className="title" weight={titleFontWeight}>
|
|
94
95
|
{title}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
|
|
1
3
|
import Box from '@mui/material/Box';
|
|
2
4
|
import { styled } from '@nuskin/foundation-theme';
|
|
3
|
-
import { ReactNode } from 'react';
|
|
4
5
|
|
|
5
|
-
import {
|
|
6
|
+
import { BynderMedia } from '../image/BynderMedia';
|
|
7
|
+
import { BynderImageDataType } from '../image/types';
|
|
6
8
|
|
|
7
9
|
type NsPostProps = {
|
|
8
10
|
text: string;
|
|
9
11
|
body: string;
|
|
10
|
-
|
|
11
|
-
backgroundImageAlt: string;
|
|
12
|
+
backgroundImageDetail: BynderImageDataType;
|
|
12
13
|
className?: string;
|
|
13
14
|
};
|
|
14
15
|
|
|
@@ -58,12 +59,10 @@ const CardContainer = styled(Box)(() => {
|
|
|
58
59
|
};
|
|
59
60
|
});
|
|
60
61
|
|
|
61
|
-
const NsPost = ({ text, body,
|
|
62
|
+
const NsPost = ({ text, body, backgroundImageDetail, className }: NsPostProps): ReactElement => {
|
|
62
63
|
return (
|
|
63
64
|
<CardContainer className={className} data-testid="post-card">
|
|
64
|
-
<
|
|
65
|
-
<NsImage height={'100%'} width={'auto'} alt={backgroundImageAlt} src={backgroundImageUrl} />
|
|
66
|
-
</div>
|
|
65
|
+
<BynderMedia className="image" imageDetail={backgroundImageDetail} />
|
|
67
66
|
<div className="content">
|
|
68
67
|
<article className="body-title">{text}</article>
|
|
69
68
|
<article className="body-text">{body}</article>
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
|
|
2
3
|
import Box from '@mui/material/Box';
|
|
3
4
|
import { styled } from '@nuskin/foundation-theme';
|
|
4
|
-
import { ReactNode } from 'react';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { BynderMedia } from '../image/BynderMedia';
|
|
7
|
+
import { BynderImageDataType } from '../image/types';
|
|
7
8
|
import CardButton from './CardButton';
|
|
9
|
+
import { NsCardButton } from './types';
|
|
8
10
|
|
|
9
11
|
type NsSmallFullCardProps = {
|
|
10
12
|
title: string;
|
|
11
13
|
subtitle: string;
|
|
12
|
-
|
|
13
|
-
backgroundImageAlt: string;
|
|
14
|
+
backgroundImageDetail: BynderImageDataType;
|
|
14
15
|
button?: NsCardButton;
|
|
15
16
|
className?: string;
|
|
16
17
|
};
|
|
@@ -68,14 +69,13 @@ const CardContainer = styled(Box)(() => {
|
|
|
68
69
|
export default function NsSmallFullCard({
|
|
69
70
|
title,
|
|
70
71
|
subtitle,
|
|
71
|
-
|
|
72
|
-
backgroundImageAlt,
|
|
72
|
+
backgroundImageDetail,
|
|
73
73
|
button,
|
|
74
74
|
className,
|
|
75
|
-
}: NsSmallFullCardProps):
|
|
75
|
+
}: NsSmallFullCardProps): ReactElement {
|
|
76
76
|
return (
|
|
77
77
|
<CardContainer className={className} role="small-full-card" component="div" data-testid="small-full-card">
|
|
78
|
-
<
|
|
78
|
+
<BynderMedia className="image" imageDetail={backgroundImageDetail} />
|
|
79
79
|
<div className="gradientOverlay"></div>
|
|
80
80
|
<div className="content">
|
|
81
81
|
<article className="subtitle">{subtitle}</article>
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
|
|
2
3
|
import Box from '@mui/material/Box';
|
|
3
4
|
import { styled } from '@nuskin/foundation-theme';
|
|
4
|
-
import { ReactNode } from 'react';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { BynderMedia } from '../image/BynderMedia';
|
|
7
|
+
import { BynderImageDataType } from '../image/types';
|
|
7
8
|
import CardButton from './CardButton';
|
|
9
|
+
import { NsCardButton } from './types';
|
|
8
10
|
|
|
9
11
|
type NsXLargeCardProps = {
|
|
10
12
|
title: string;
|
|
11
13
|
subtitle: string;
|
|
12
|
-
|
|
13
|
-
backgroundImageAlt: string;
|
|
14
|
+
backgroundImageDetail: BynderImageDataType;
|
|
14
15
|
button?: NsCardButton;
|
|
15
16
|
className?: string;
|
|
16
17
|
};
|
|
@@ -64,14 +65,13 @@ const CardContainer = styled(Box)(() => {
|
|
|
64
65
|
export default function NsXLargeCard({
|
|
65
66
|
title,
|
|
66
67
|
subtitle,
|
|
67
|
-
|
|
68
|
-
backgroundImageAlt,
|
|
68
|
+
backgroundImageDetail,
|
|
69
69
|
button,
|
|
70
70
|
className,
|
|
71
|
-
}: NsXLargeCardProps):
|
|
71
|
+
}: NsXLargeCardProps): ReactElement {
|
|
72
72
|
return (
|
|
73
73
|
<CardContainer className={className} role="x-large-card" component="div" data-testid="x-large-card">
|
|
74
|
-
<
|
|
74
|
+
<BynderMedia className="image" imageDetail={backgroundImageDetail} />
|
|
75
75
|
<div className="gradientOverlay"></div>
|
|
76
76
|
<div className="content">
|
|
77
77
|
<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', () => {
|