@nuskin/foundation-ui-components 1.6.1 → 1.7.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 -1
- package/src/common/card/NsBrandCard.tsx +94 -0
- package/src/common/card/NsCheckoutCard.tsx +92 -0
- package/src/common/card/NsHeroCardLevel1.tsx +106 -0
- package/src/common/card/NsHeroCardLevel2.tsx +126 -0
- package/src/common/card/NsIconText.tsx +153 -0
- package/src/common/card/NsLargeCard.tsx +120 -0
- package/src/common/card/NsMediumCard.tsx +64 -0
- package/src/common/card/NsPost.tsx +60 -0
- package/src/common/card/NsSmallFullCard.tsx +90 -0
- package/src/common/card/NsXLargeCard.tsx +80 -0
- package/src/common/card/cardSizes.ts +12 -0
- package/src/common/card/index.ts +10 -2
- package/src/common/card/specs/BrandLogo.spec.tsx +1 -1
- package/src/common/card/specs/NsBgCard.spec.tsx +2 -2
- package/src/common/card/specs/NsBrandCard.spec.tsx +97 -0
- package/src/common/card/specs/NsCheckoutCard.spec.tsx +50 -0
- package/src/common/card/specs/NsHeroCardLevel1.spec.tsx +48 -0
- package/src/common/card/specs/NsHeroCardLevel2.spec.tsx +51 -0
- package/src/common/card/specs/NsIconText.spec.tsx +28 -0
- package/src/common/card/specs/NsLargeCard.spec.tsx +41 -0
- package/src/common/card/specs/NsMediumCard.spec.tsx +35 -0
- package/src/common/card/specs/NsPost.spec.tsx +31 -0
- package/src/common/card/specs/NsSmallFullCard.spec.tsx +36 -0
- package/src/common/card/specs/NsXLargeCard.spec.tsx +35 -0
- package/src/common/card/stories/{NsBrandProductCard.stories.tsx → NsBrandCard.stories.tsx} +9 -4
- package/src/common/card/stories/NsCheckoutCard.stories.tsx +24 -0
- package/src/common/card/stories/NsHeroCardLevel1.stories.tsx +45 -0
- package/src/common/card/stories/NsHeroCardLevel2.stories.tsx +50 -0
- package/src/common/card/stories/NsIconText.stories.tsx +36 -0
- package/src/common/card/stories/NsLargeCard.stories.tsx +32 -0
- package/src/common/card/stories/NsMediumCard.stories.tsx +29 -0
- package/src/common/card/stories/NsPost.stories.tsx +39 -0
- package/src/common/card/stories/NsSmallFullCard.stories.tsx +29 -0
- package/src/common/card/stories/NsXLargeCard.stories.tsx +29 -0
- package/src/common/carousal/RenderBrand.tsx +3 -2
- package/src/common/card/NsBrandProductCard.tsx +0 -47
- package/src/common/card/NsFfgCard.tsx +0 -24
- package/src/common/card/specs/NsBrandProductCard.spec.tsx +0 -32
- package/src/common/card/specs/NsFfgCard.spec.tsx +0 -33
- package/src/common/card/stories/NsBgCard.stories.tsx +0 -20
- package/src/common/card/stories/NsFfgCard.stories.tsx +0 -73
- package/src/common/card/styled/NsFfgStyled.tsx +0 -46
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import { NsHeroCardLevel2 } from '../';
|
|
5
|
+
|
|
6
|
+
describe('NsHeroCardLevel2 component', () => {
|
|
7
|
+
const props = {
|
|
8
|
+
brand: 'Beauty focus™',
|
|
9
|
+
text: 'Current shop deals',
|
|
10
|
+
body: 'Lumispa, sunscreen and more',
|
|
11
|
+
icon: 'home' as 'home',
|
|
12
|
+
cardLink: {
|
|
13
|
+
href: 'https://www.forceforgood.org/',
|
|
14
|
+
title: 'Discover more',
|
|
15
|
+
},
|
|
16
|
+
backgroundImageUrl: 'https://media.nuskin.com/m/5f1c423bb57589f0/webimage-autumn-sale-carousel.png',
|
|
17
|
+
backgroundImageAlt: 'lash brow serum carousel',
|
|
18
|
+
additionalProps: {
|
|
19
|
+
testid: 'hero-card-level-2',
|
|
20
|
+
},
|
|
21
|
+
onClick: jest.fn(),
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
it('1. renders with correct content and styles', () => {
|
|
25
|
+
render(<NsHeroCardLevel2 {...props} />);
|
|
26
|
+
|
|
27
|
+
const cardContainer = screen.getByTestId('hero-card-level-2');
|
|
28
|
+
expect(cardContainer).toBeInTheDocument();
|
|
29
|
+
|
|
30
|
+
const brandText = screen.getByText('Beauty focus™');
|
|
31
|
+
expect(brandText).toBeInTheDocument();
|
|
32
|
+
|
|
33
|
+
const textContent = screen.getByText('Current shop deals');
|
|
34
|
+
expect(textContent).toBeInTheDocument();
|
|
35
|
+
|
|
36
|
+
const bodyContent = screen.getByText('Lumispa, sunscreen and more');
|
|
37
|
+
expect(bodyContent).toBeInTheDocument();
|
|
38
|
+
|
|
39
|
+
const discoverMoreLink = screen.getByRole('link', { name: 'Discover more' });
|
|
40
|
+
expect(discoverMoreLink).toBeInTheDocument();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('2. calls onClick when the card is clicked', () => {
|
|
44
|
+
render(<NsHeroCardLevel2 {...props} />);
|
|
45
|
+
|
|
46
|
+
const cardContainer = screen.getByTestId('hero-card-level-2');
|
|
47
|
+
userEvent.click(cardContainer);
|
|
48
|
+
|
|
49
|
+
expect(props.onClick).toHaveBeenCalled();
|
|
50
|
+
});
|
|
51
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { NsIconText } from '../';
|
|
4
|
+
|
|
5
|
+
describe('NsIconText component', () => {
|
|
6
|
+
const props = {
|
|
7
|
+
text: 'Lorem ipsum',
|
|
8
|
+
body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Natoque lacus, in amet nunc. ',
|
|
9
|
+
additionalProps: {
|
|
10
|
+
testid: 'icon-text-card',
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
it('1. renders with correct content and styles', () => {
|
|
15
|
+
render(<NsIconText {...props} />);
|
|
16
|
+
|
|
17
|
+
const cardContainer = screen.getByTestId('icon-text-card');
|
|
18
|
+
expect(cardContainer).toBeInTheDocument();
|
|
19
|
+
|
|
20
|
+
const textContent = screen.getByText('Lorem ipsum');
|
|
21
|
+
expect(textContent).toBeInTheDocument();
|
|
22
|
+
|
|
23
|
+
const bodyContent = screen.getByText(
|
|
24
|
+
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Natoque lacus, in amet nunc.'
|
|
25
|
+
);
|
|
26
|
+
expect(bodyContent).toBeInTheDocument();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { NsLargeCard } from '../';
|
|
4
|
+
|
|
5
|
+
describe('NsLargeCard component', () => {
|
|
6
|
+
const props = {
|
|
7
|
+
title: 'Title',
|
|
8
|
+
subtitle: 'Subtitle',
|
|
9
|
+
intro: 'Introduction sentence',
|
|
10
|
+
icon: 'cart' as 'cart',
|
|
11
|
+
cardLink: {
|
|
12
|
+
href: 'https://www.forceforgood.org/',
|
|
13
|
+
title: 'Button Text',
|
|
14
|
+
},
|
|
15
|
+
backgroundImageUrl: 'https://example.com/image.jpg',
|
|
16
|
+
backgroundImageAlt: 'Image Alt',
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
it('1. renders with correct content and styles', () => {
|
|
20
|
+
render(<NsLargeCard {...props} />);
|
|
21
|
+
|
|
22
|
+
expect(screen.getByText(props.title)).toBeInTheDocument();
|
|
23
|
+
expect(screen.getByText(props.subtitle)).toBeInTheDocument();
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('2. triggers the link when clicked', () => {
|
|
27
|
+
render(<NsLargeCard {...props} />);
|
|
28
|
+
|
|
29
|
+
userEvent.click(screen.getByRole('link'));
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('3. renders NsLink and NsIcon when isHorizontal is true', () => {
|
|
33
|
+
render(<NsLargeCard {...props} isHorizontal={true} />);
|
|
34
|
+
|
|
35
|
+
const actionLink = screen.getByText(props.cardLink.title);
|
|
36
|
+
expect(actionLink).toBeInTheDocument();
|
|
37
|
+
|
|
38
|
+
const parentDiv = actionLink.closest('.cta');
|
|
39
|
+
expect(parentDiv).toBeInTheDocument();
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import NsMediumCard from '../NsMediumCard';
|
|
4
|
+
|
|
5
|
+
describe('NsMediumCard component', () => {
|
|
6
|
+
const props = {
|
|
7
|
+
title: 'Sample Title',
|
|
8
|
+
subtitle: 'Sample Subtitle',
|
|
9
|
+
backgroundImageUrl: 'https://example.com/image.jpg',
|
|
10
|
+
backgroundImageAlt: 'Sample Alt Text',
|
|
11
|
+
cardLink: {
|
|
12
|
+
href: 'https://www.example.com',
|
|
13
|
+
title: 'Sample Link Text',
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
it('1. renders with correct content and styles', () => {
|
|
18
|
+
render(<NsMediumCard {...props} />);
|
|
19
|
+
|
|
20
|
+
const mediumCard = screen.getByTestId('medium-card');
|
|
21
|
+
expect(mediumCard).toBeInTheDocument();
|
|
22
|
+
|
|
23
|
+
const titleElement = screen.getByText('Sample Title');
|
|
24
|
+
expect(titleElement).toBeInTheDocument();
|
|
25
|
+
|
|
26
|
+
const subtitleElement = screen.getByText('Sample Subtitle');
|
|
27
|
+
expect(subtitleElement).toBeInTheDocument();
|
|
28
|
+
|
|
29
|
+
const imageElement = screen.getByAltText('Sample Alt Text');
|
|
30
|
+
expect(imageElement).toBeInTheDocument();
|
|
31
|
+
|
|
32
|
+
const linkElement = screen.getByText('Sample Link Text');
|
|
33
|
+
expect(linkElement).toBeInTheDocument();
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import NsPost from '../NsPost';
|
|
4
|
+
|
|
5
|
+
describe('NsPost component', () => {
|
|
6
|
+
const props = {
|
|
7
|
+
text: 'Sample Text',
|
|
8
|
+
body: 'Sample Body',
|
|
9
|
+
backgroundImageUrl: 'https://example.com/image.jpg',
|
|
10
|
+
backgroundImageAlt: 'Sample Alt Text',
|
|
11
|
+
additionalProps: {
|
|
12
|
+
testid: 'sample-post',
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
it('1. renders with correct content and styles', () => {
|
|
17
|
+
render(<NsPost {...props} />);
|
|
18
|
+
|
|
19
|
+
const postContainer = screen.getByTestId('sample-post');
|
|
20
|
+
expect(postContainer).toBeInTheDocument();
|
|
21
|
+
|
|
22
|
+
const textElement = screen.getByText('Sample Text');
|
|
23
|
+
expect(textElement).toBeInTheDocument();
|
|
24
|
+
|
|
25
|
+
const bodyElement = screen.getByText('Sample Body');
|
|
26
|
+
expect(bodyElement).toBeInTheDocument();
|
|
27
|
+
|
|
28
|
+
const imageElement = screen.getByAltText('Sample Alt Text');
|
|
29
|
+
expect(imageElement).toBeInTheDocument();
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import NsSmallFullCard from '../NsSmallFullCard';
|
|
4
|
+
|
|
5
|
+
describe('NsSmallFullCard component', () => {
|
|
6
|
+
const props = {
|
|
7
|
+
title: 'Sample Title',
|
|
8
|
+
subtitle: 'Sample Subtitle',
|
|
9
|
+
backgroundImageUrl: 'https://example.com/image.jpg',
|
|
10
|
+
backgroundImageAlt: 'Sample Alt Text',
|
|
11
|
+
cardLink: {
|
|
12
|
+
href: 'https://www.example.com',
|
|
13
|
+
title: 'Button Text',
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
it('1. renders with correct content and styles', () => {
|
|
18
|
+
render(<NsSmallFullCard {...props} />);
|
|
19
|
+
|
|
20
|
+
const cardContainer = screen.getByTestId('small-full-card');
|
|
21
|
+
expect(cardContainer).toBeInTheDocument();
|
|
22
|
+
|
|
23
|
+
const titleElement = screen.getByText('Sample Title');
|
|
24
|
+
expect(titleElement).toBeInTheDocument();
|
|
25
|
+
|
|
26
|
+
const subtitleElement = screen.getByText('Sample Subtitle');
|
|
27
|
+
expect(subtitleElement).toBeInTheDocument();
|
|
28
|
+
|
|
29
|
+
const imageElement = screen.getByAltText('Sample Alt Text');
|
|
30
|
+
expect(imageElement).toBeInTheDocument();
|
|
31
|
+
|
|
32
|
+
const linkElement = screen.getByText('Button Text');
|
|
33
|
+
expect(linkElement).toBeInTheDocument();
|
|
34
|
+
expect(linkElement).toHaveAttribute('href', 'https://www.example.com');
|
|
35
|
+
});
|
|
36
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import NsXLargeCard from '../NsXLargeCard';
|
|
4
|
+
|
|
5
|
+
describe('NsXLargeCard component', () => {
|
|
6
|
+
const props = {
|
|
7
|
+
title: 'Sample Title',
|
|
8
|
+
subtitle: 'Sample Subtitle',
|
|
9
|
+
backgroundImageUrl: 'https://example.com/image.jpg',
|
|
10
|
+
backgroundImageAlt: 'Sample Alt Text',
|
|
11
|
+
cardLink: {
|
|
12
|
+
href: 'https://www.example.com',
|
|
13
|
+
title: 'Sample Link Text',
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
it('1. renders with correct content and styles', () => {
|
|
18
|
+
render(<NsXLargeCard {...props} />);
|
|
19
|
+
|
|
20
|
+
const xLargeCard = screen.getByTestId('x-large-card');
|
|
21
|
+
expect(xLargeCard).toBeInTheDocument();
|
|
22
|
+
|
|
23
|
+
const subtitleElement = screen.getByText('Sample Subtitle');
|
|
24
|
+
expect(subtitleElement).toBeInTheDocument();
|
|
25
|
+
|
|
26
|
+
const titleElement = screen.getByText('Sample Title');
|
|
27
|
+
expect(titleElement).toBeInTheDocument();
|
|
28
|
+
|
|
29
|
+
const imageElement = screen.getByAltText('Sample Alt Text');
|
|
30
|
+
expect(imageElement).toBeInTheDocument();
|
|
31
|
+
|
|
32
|
+
const linkElement = screen.getByText('Sample Link Text');
|
|
33
|
+
expect(linkElement).toBeInTheDocument();
|
|
34
|
+
});
|
|
35
|
+
});
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { StoryObj, Meta } from '@storybook/react';
|
|
2
2
|
import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
|
|
3
|
-
import {
|
|
3
|
+
import { NsBrandCard } from '../';
|
|
4
4
|
|
|
5
|
-
type ComponentType = typeof
|
|
5
|
+
type ComponentType = typeof NsBrandCard;
|
|
6
6
|
type Story = StoryObj<ComponentType>;
|
|
7
7
|
type MetaStory = Meta<ComponentType>;
|
|
8
8
|
|
|
9
9
|
export default {
|
|
10
|
-
component:
|
|
11
|
-
title: 'Components/Containers/Card/
|
|
10
|
+
component: NsBrandCard,
|
|
11
|
+
title: 'Components/Containers/Card/NsBrandCard',
|
|
12
12
|
argTypes: {},
|
|
13
13
|
decorators: [withCenterDecorator],
|
|
14
14
|
} as MetaStory;
|
|
@@ -18,5 +18,10 @@ export const Default: Story = {
|
|
|
18
18
|
title: 'ageLOC LumiSpa',
|
|
19
19
|
backgroundImageUrl: 'https://media.nuskin.com/m/3604b5202b0b64c6/webimage-brand-lumispa-optweb.png',
|
|
20
20
|
brandImageUrl: 'https://media.nuskin.com/m/2571a0407433a6e8/webimage-brand-lumispa.png',
|
|
21
|
+
size: 'large',
|
|
22
|
+
button: true,
|
|
23
|
+
onClick: () => {
|
|
24
|
+
console.log('onClick called');
|
|
25
|
+
},
|
|
21
26
|
},
|
|
22
27
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { StoryObj, Meta } from '@storybook/react';
|
|
2
|
+
import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
|
|
3
|
+
import { NsCheckoutCard } from '../';
|
|
4
|
+
|
|
5
|
+
type ComponentType = typeof NsCheckoutCard;
|
|
6
|
+
type Story = StoryObj<ComponentType>;
|
|
7
|
+
type MetaStory = Meta<ComponentType>;
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
component: NsCheckoutCard,
|
|
11
|
+
title: 'Components/Containers/Card/NsCheckoutCard',
|
|
12
|
+
argTypes: {
|
|
13
|
+
onClick: { action: 'clicked' },
|
|
14
|
+
},
|
|
15
|
+
decorators: [withCenterDecorator],
|
|
16
|
+
} as MetaStory;
|
|
17
|
+
|
|
18
|
+
export const Default: Story = {
|
|
19
|
+
args: {
|
|
20
|
+
title: 'Section Title',
|
|
21
|
+
address: 'Address',
|
|
22
|
+
icon: 'home',
|
|
23
|
+
},
|
|
24
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { StoryObj, Meta } from '@storybook/react';
|
|
2
|
+
import { within, userEvent } from '@storybook/testing-library';
|
|
3
|
+
import { expect } from '@storybook/jest';
|
|
4
|
+
import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
|
|
5
|
+
import { NsHeroCardLevel1 } from '../';
|
|
6
|
+
|
|
7
|
+
type ComponentType = typeof NsHeroCardLevel1;
|
|
8
|
+
type Story = StoryObj<ComponentType>;
|
|
9
|
+
type MetaStory = Meta<ComponentType>;
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
component: NsHeroCardLevel1,
|
|
13
|
+
title: 'Components/Containers/Card/NsHeroCardLevel1',
|
|
14
|
+
argTypes: {
|
|
15
|
+
onClick: { action: 'clicked' },
|
|
16
|
+
},
|
|
17
|
+
decorators: [withCenterDecorator],
|
|
18
|
+
} as MetaStory;
|
|
19
|
+
|
|
20
|
+
const text = 'A skin ready for winter';
|
|
21
|
+
const body = 'We have brought these discoveries to life through our powerful skin care products and supplements.';
|
|
22
|
+
const host = 'https://media.nuskin.com/';
|
|
23
|
+
|
|
24
|
+
export const Default: Story = {
|
|
25
|
+
args: {
|
|
26
|
+
cardLink: {
|
|
27
|
+
href: 'https://www.forceforgood.org/',
|
|
28
|
+
title: 'SHOP NOW',
|
|
29
|
+
},
|
|
30
|
+
text,
|
|
31
|
+
body,
|
|
32
|
+
backgroundImageUrl: `${host}m/9734240cc191163/webimage-lash-brow-serum-carousel-image-launch.png`,
|
|
33
|
+
backgroundImageAlt: 'lash brow serum carousel',
|
|
34
|
+
additionalProps: {
|
|
35
|
+
testid: 'hero-card-level-1',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
play: async ({ canvasElement }: any) => {
|
|
39
|
+
const canvas = within(canvasElement);
|
|
40
|
+
userEvent.hover(canvas.getByTestId('hero-card-level-1'));
|
|
41
|
+
userEvent.hover(canvas.getByRole('link'));
|
|
42
|
+
expect(canvas.getByText(text)).toBeInTheDocument();
|
|
43
|
+
expect(canvas.getByText(body)).toBeInTheDocument();
|
|
44
|
+
},
|
|
45
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { StoryObj, Meta } from '@storybook/react';
|
|
2
|
+
import { within, userEvent } from '@storybook/testing-library';
|
|
3
|
+
import { expect } from '@storybook/jest';
|
|
4
|
+
import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
|
|
5
|
+
import { NsHeroCardLevel2 } from '../';
|
|
6
|
+
|
|
7
|
+
type ComponentType = typeof NsHeroCardLevel2;
|
|
8
|
+
type Story = StoryObj<ComponentType>;
|
|
9
|
+
type MetaStory = Meta<ComponentType>;
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
component: NsHeroCardLevel2,
|
|
13
|
+
title: 'Components/Containers/Card/NsHeroCardLevel2',
|
|
14
|
+
argTypes: {
|
|
15
|
+
onClick: { action: 'clicked' },
|
|
16
|
+
},
|
|
17
|
+
decorators: [withCenterDecorator],
|
|
18
|
+
} as MetaStory;
|
|
19
|
+
|
|
20
|
+
const text = 'Current shop deals';
|
|
21
|
+
const body = 'Lumispa, sunscreen and more';
|
|
22
|
+
const icon = 'home';
|
|
23
|
+
const brand = 'Beauty focus™';
|
|
24
|
+
const host = 'https://media.nuskin.com/';
|
|
25
|
+
|
|
26
|
+
export const Default: Story = {
|
|
27
|
+
args: {
|
|
28
|
+
cardLink: {
|
|
29
|
+
href: 'https://www.forceforgood.org/',
|
|
30
|
+
title: 'Discover more',
|
|
31
|
+
},
|
|
32
|
+
text,
|
|
33
|
+
body,
|
|
34
|
+
icon,
|
|
35
|
+
brand,
|
|
36
|
+
backgroundImageUrl: `${host}m/5f1c423bb57589f0/webimage-autumn-sale-carousel.png`,
|
|
37
|
+
backgroundImageAlt: 'lash brow serum carousel',
|
|
38
|
+
additionalProps: {
|
|
39
|
+
testid: 'hero-card-level-2',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
play: async ({ canvasElement }: any) => {
|
|
43
|
+
const canvas = within(canvasElement);
|
|
44
|
+
userEvent.hover(canvas.getByTestId('hero-card-level-2'));
|
|
45
|
+
userEvent.hover(canvas.getByRole('link'));
|
|
46
|
+
expect(canvas.getByText(text)).toBeInTheDocument();
|
|
47
|
+
expect(canvas.getByText(body)).toBeInTheDocument();
|
|
48
|
+
expect(canvas.getByText(brand)).toBeInTheDocument();
|
|
49
|
+
},
|
|
50
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { StoryObj, Meta } from '@storybook/react';
|
|
2
|
+
import { within, userEvent } from '@storybook/testing-library';
|
|
3
|
+
import { expect } from '@storybook/jest';
|
|
4
|
+
import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
|
|
5
|
+
import { NsIconText } from '../';
|
|
6
|
+
|
|
7
|
+
type ComponentType = typeof NsIconText;
|
|
8
|
+
type Story = StoryObj<ComponentType>;
|
|
9
|
+
type MetaStory = Meta<ComponentType>;
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
component: NsIconText,
|
|
13
|
+
title: 'Components/Containers/Card/NsIconText',
|
|
14
|
+
argTypes: {},
|
|
15
|
+
decorators: [withCenterDecorator],
|
|
16
|
+
} as MetaStory;
|
|
17
|
+
|
|
18
|
+
const text = 'Lorem ipsum';
|
|
19
|
+
const body = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Natoque lacus, in amet nunc. ';
|
|
20
|
+
|
|
21
|
+
export const Default: Story = {
|
|
22
|
+
args: {
|
|
23
|
+
text,
|
|
24
|
+
body,
|
|
25
|
+
additionalProps: {
|
|
26
|
+
testid: 'icon-text-card',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
play: async ({ canvasElement }: any) => {
|
|
30
|
+
const canvas = within(canvasElement);
|
|
31
|
+
userEvent.hover(canvas.getByTestId('icon-text-card'));
|
|
32
|
+
userEvent.hover(canvas.getByRole('link'));
|
|
33
|
+
expect(canvas.getByText(text)).toBeInTheDocument();
|
|
34
|
+
expect(canvas.getByText(body)).toBeInTheDocument();
|
|
35
|
+
},
|
|
36
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { StoryObj, Meta } from '@storybook/react';
|
|
2
|
+
import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
|
|
3
|
+
import { NsLargeCard } from '../';
|
|
4
|
+
|
|
5
|
+
type ComponentType = typeof NsLargeCard;
|
|
6
|
+
type Story = StoryObj<ComponentType>;
|
|
7
|
+
type MetaStory = Meta<ComponentType>;
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
component: NsLargeCard,
|
|
11
|
+
title: 'Components/Containers/Card/NsLargeCard',
|
|
12
|
+
argTypes: {},
|
|
13
|
+
decorators: [withCenterDecorator],
|
|
14
|
+
} as MetaStory;
|
|
15
|
+
|
|
16
|
+
const host = 'https://media.nuskin.com';
|
|
17
|
+
|
|
18
|
+
export const Default: Story = {
|
|
19
|
+
args: {
|
|
20
|
+
isHorizontal: false,
|
|
21
|
+
title: 'Title',
|
|
22
|
+
subtitle: 'Subtitle',
|
|
23
|
+
intro: 'Introduction sentence',
|
|
24
|
+
icon: 'cart',
|
|
25
|
+
cardLink: {
|
|
26
|
+
href: 'https://www.forceforgood.org/',
|
|
27
|
+
title: 'Button Text',
|
|
28
|
+
},
|
|
29
|
+
backgroundImageUrl: `${host}/m/36f2a073f3de08a2/Small-category-facial_cleansers.jpg`,
|
|
30
|
+
backgroundImageAlt: 'Facial Moisturizers',
|
|
31
|
+
},
|
|
32
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { StoryObj, Meta } from '@storybook/react';
|
|
2
|
+
import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
|
|
3
|
+
import { NsMediumCard } from '../';
|
|
4
|
+
|
|
5
|
+
type ComponentType = typeof NsMediumCard;
|
|
6
|
+
type Story = StoryObj<ComponentType>;
|
|
7
|
+
type MetaStory = Meta<ComponentType>;
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
component: NsMediumCard,
|
|
11
|
+
title: 'Components/Containers/Card/NsMediumCard',
|
|
12
|
+
argTypes: {},
|
|
13
|
+
decorators: [withCenterDecorator],
|
|
14
|
+
} as MetaStory;
|
|
15
|
+
|
|
16
|
+
const host = 'https://media.nuskin.com';
|
|
17
|
+
|
|
18
|
+
export const Default: Story = {
|
|
19
|
+
args: {
|
|
20
|
+
title: 'Introducing LumiSpa',
|
|
21
|
+
subtitle: 'Lorem ipsum dolor',
|
|
22
|
+
cardLink: {
|
|
23
|
+
href: 'https://www.forceforgood.org/',
|
|
24
|
+
title: 'Button Text',
|
|
25
|
+
},
|
|
26
|
+
backgroundImageUrl: `${host}/m/3353b9c05cb83860/Small-category-facial_moisturizers.jpg`,
|
|
27
|
+
backgroundImageAlt: 'Lumi Spa',
|
|
28
|
+
},
|
|
29
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { StoryObj, Meta } from '@storybook/react';
|
|
2
|
+
import { within, userEvent } from '@storybook/testing-library';
|
|
3
|
+
import { expect } from '@storybook/jest';
|
|
4
|
+
import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
|
|
5
|
+
import { NsPost } from '../';
|
|
6
|
+
|
|
7
|
+
type ComponentType = typeof NsPost;
|
|
8
|
+
type Story = StoryObj<ComponentType>;
|
|
9
|
+
type MetaStory = Meta<ComponentType>;
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
component: NsPost,
|
|
13
|
+
title: 'Components/Containers/Card/NsPost',
|
|
14
|
+
argTypes: {},
|
|
15
|
+
decorators: [withCenterDecorator],
|
|
16
|
+
} as MetaStory;
|
|
17
|
+
|
|
18
|
+
const text = 'Heading';
|
|
19
|
+
const body = 'Date';
|
|
20
|
+
const host = 'https://media.nuskin.com/';
|
|
21
|
+
|
|
22
|
+
export const Default: Story = {
|
|
23
|
+
args: {
|
|
24
|
+
text,
|
|
25
|
+
body,
|
|
26
|
+
backgroundImageUrl: `${host}m/780f8d84bcb9d5ed/Small-Essence_News.jpg`,
|
|
27
|
+
backgroundImageAlt: 'small essence news',
|
|
28
|
+
additionalProps: {
|
|
29
|
+
testid: 'post-card',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
play: async ({ canvasElement }: any) => {
|
|
33
|
+
const canvas = within(canvasElement);
|
|
34
|
+
userEvent.hover(canvas.getByTestId('post-card'));
|
|
35
|
+
userEvent.hover(canvas.getByRole('link'));
|
|
36
|
+
expect(canvas.getByText(text)).toBeInTheDocument();
|
|
37
|
+
expect(canvas.getByText(body)).toBeInTheDocument();
|
|
38
|
+
},
|
|
39
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { StoryObj, Meta } from '@storybook/react';
|
|
2
|
+
import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
|
|
3
|
+
import { NsSmallFullCard } from '../';
|
|
4
|
+
|
|
5
|
+
type ComponentType = typeof NsSmallFullCard;
|
|
6
|
+
type Story = StoryObj<ComponentType>;
|
|
7
|
+
type MetaStory = Meta<ComponentType>;
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
component: NsSmallFullCard,
|
|
11
|
+
title: 'Components/Containers/Card/NsSmallFullCard',
|
|
12
|
+
argTypes: {},
|
|
13
|
+
decorators: [withCenterDecorator],
|
|
14
|
+
} as MetaStory;
|
|
15
|
+
|
|
16
|
+
const host = 'https://media.nuskin.com';
|
|
17
|
+
|
|
18
|
+
export const Default: Story = {
|
|
19
|
+
args: {
|
|
20
|
+
title: 'Title',
|
|
21
|
+
subtitle: 'Subtitle',
|
|
22
|
+
cardLink: {
|
|
23
|
+
href: 'https://www.forceforgood.org/',
|
|
24
|
+
title: 'Placeholder',
|
|
25
|
+
},
|
|
26
|
+
backgroundImageUrl: `${host}/m/4f5b0aee8fe3ff90/Small-category-makeup.jpg`,
|
|
27
|
+
backgroundImageAlt: 'Facial Moisturizers',
|
|
28
|
+
},
|
|
29
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { StoryObj, Meta } from '@storybook/react';
|
|
2
|
+
import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
|
|
3
|
+
import { NsXLargeCard } from '../';
|
|
4
|
+
|
|
5
|
+
type ComponentType = typeof NsXLargeCard;
|
|
6
|
+
type Story = StoryObj<ComponentType>;
|
|
7
|
+
type MetaStory = Meta<ComponentType>;
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
component: NsXLargeCard,
|
|
11
|
+
title: 'Components/Containers/Card/NsXLargeCard',
|
|
12
|
+
argTypes: {},
|
|
13
|
+
decorators: [withCenterDecorator],
|
|
14
|
+
} as MetaStory;
|
|
15
|
+
|
|
16
|
+
const host = 'https://media.nuskin.com';
|
|
17
|
+
|
|
18
|
+
export const Default: Story = {
|
|
19
|
+
args: {
|
|
20
|
+
title: 'Title',
|
|
21
|
+
subtitle: 'Subtitle',
|
|
22
|
+
cardLink: {
|
|
23
|
+
href: 'https://www.forceforgood.org/',
|
|
24
|
+
title: 'Call to action',
|
|
25
|
+
},
|
|
26
|
+
backgroundImageUrl: `${host}/m/4f5b0aee8fe3ff90/Small-category-makeup.jpg`,
|
|
27
|
+
backgroundImageAlt: 'Facial Moisturizers',
|
|
28
|
+
},
|
|
29
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import NsBrandCard from '../card/NsBrandCard';
|
|
2
2
|
|
|
3
3
|
interface BrandType {
|
|
4
4
|
title: string;
|
|
@@ -8,11 +8,12 @@ interface BrandType {
|
|
|
8
8
|
export const RenderBrand = (entry: BrandType, index: number) => {
|
|
9
9
|
const { title, backgroundImage, brandImage } = entry;
|
|
10
10
|
return (
|
|
11
|
-
<
|
|
11
|
+
<NsBrandCard
|
|
12
12
|
key={title + index}
|
|
13
13
|
backgroundImageUrl={backgroundImage}
|
|
14
14
|
title={title}
|
|
15
15
|
brandImageUrl={brandImage}
|
|
16
|
+
button={false}
|
|
16
17
|
/>
|
|
17
18
|
);
|
|
18
19
|
};
|