@faststore/ui 1.8.16 → 1.8.19
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/CHANGELOG.md +27 -0
- package/dist/index.d.ts +4 -2
- package/dist/{organisms → molecules}/Card/Card.d.ts +0 -0
- package/dist/{organisms → molecules}/Card/CardActions.d.ts +0 -0
- package/dist/{organisms → molecules}/Card/CardContent.d.ts +0 -0
- package/dist/{organisms → molecules}/Card/CardImage.d.ts +0 -0
- package/dist/{organisms → molecules}/Card/index.d.ts +0 -0
- package/dist/{organisms → molecules}/Card/stories/Card.stories.d.ts +0 -0
- package/dist/molecules/ProductCard/ProductCard.d.ts +11 -0
- package/dist/molecules/ProductCard/ProductCardActions.d.ts +10 -0
- package/dist/molecules/ProductCard/ProductCardContent.d.ts +10 -0
- package/dist/molecules/ProductCard/ProductCardImage.d.ts +10 -0
- package/dist/molecules/ProductCard/index.d.ts +8 -0
- package/dist/molecules/ProductCard/stories/ProductCard.stories.d.ts +4 -0
- package/dist/ui.cjs.development.js +100 -48
- package/dist/ui.cjs.development.js.map +1 -1
- package/dist/ui.cjs.production.min.js +1 -1
- package/dist/ui.cjs.production.min.js.map +1 -1
- package/dist/ui.esm.js +97 -49
- package/dist/ui.esm.js.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +26 -12
- package/src/{organisms → molecules}/Card/Card.test.tsx +0 -0
- package/src/{organisms → molecules}/Card/Card.tsx +0 -0
- package/src/{organisms → molecules}/Card/CardActions.tsx +0 -0
- package/src/{organisms → molecules}/Card/CardContent.tsx +0 -0
- package/src/{organisms → molecules}/Card/CardImage.tsx +0 -0
- package/src/{organisms → molecules}/Card/index.tsx +0 -0
- package/src/{organisms → molecules}/Card/stories/Card.mdx +1 -1
- package/src/molecules/Card/stories/Card.stories.tsx +63 -0
- package/src/molecules/ProductCard/ProductCard.test.tsx +75 -0
- package/src/molecules/ProductCard/ProductCard.tsx +28 -0
- package/src/molecules/ProductCard/ProductCardActions.tsx +30 -0
- package/src/molecules/ProductCard/ProductCardContent.tsx +29 -0
- package/src/molecules/ProductCard/ProductCardImage.tsx +29 -0
- package/src/molecules/ProductCard/index.tsx +11 -0
- package/src/molecules/ProductCard/stories/ProductCard.mdx +55 -0
- package/src/{organisms/Card/stories/Card.stories.tsx → molecules/ProductCard/stories/ProductCard.stories.tsx} +18 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/ui",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.19",
|
|
4
4
|
"description": "A lightweight, framework agnostic component library for React",
|
|
5
5
|
"author": "emersonlaurentino",
|
|
6
6
|
"license": "MIT",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"@types/jest-axe": "^3.5.3",
|
|
77
77
|
"@types/tabbable": "^3.1.1",
|
|
78
78
|
"@types/testing-library__jest-dom": "^5.9.5",
|
|
79
|
-
"@vtex/theme-b2c-tailwind": "^1.8.
|
|
79
|
+
"@vtex/theme-b2c-tailwind": "^1.8.19",
|
|
80
80
|
"@vtex/tsconfig": "^0.5.0",
|
|
81
81
|
"chalk": "^5.0.0",
|
|
82
82
|
"jest-axe": "^5.0.1",
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
"tsdx": "^0.14.1",
|
|
90
90
|
"typescript": "^4.2.4"
|
|
91
91
|
},
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "60c4c1c62b7c32e6bb2e407a1f1f159fd8b4143c"
|
|
93
93
|
}
|
package/src/index.ts
CHANGED
|
@@ -54,6 +54,32 @@ export { default as Incentive } from './atoms/Incentive'
|
|
|
54
54
|
export type { IncentiveProps } from './atoms/Incentive'
|
|
55
55
|
|
|
56
56
|
// Molecules
|
|
57
|
+
export {
|
|
58
|
+
default as ProductCard,
|
|
59
|
+
ProductCardImage,
|
|
60
|
+
ProductCardContent,
|
|
61
|
+
ProductCardActions,
|
|
62
|
+
} from './molecules/ProductCard'
|
|
63
|
+
export type {
|
|
64
|
+
ProductCardProps,
|
|
65
|
+
ProductCardImageProps,
|
|
66
|
+
ProductCardContentProps,
|
|
67
|
+
ProductCardActionsProps,
|
|
68
|
+
} from './molecules/ProductCard'
|
|
69
|
+
|
|
70
|
+
export {
|
|
71
|
+
default as Card,
|
|
72
|
+
CardImage,
|
|
73
|
+
CardContent,
|
|
74
|
+
CardActions,
|
|
75
|
+
} from './molecules/Card'
|
|
76
|
+
export type {
|
|
77
|
+
CardProps,
|
|
78
|
+
CardImageProps,
|
|
79
|
+
CardContentProps,
|
|
80
|
+
CardActionsProps,
|
|
81
|
+
} from './molecules/Card'
|
|
82
|
+
|
|
57
83
|
export { default as Bullets } from './molecules/Bullets'
|
|
58
84
|
export type { BulletsProps } from './molecules/Bullets'
|
|
59
85
|
|
|
@@ -150,18 +176,6 @@ export type {
|
|
|
150
176
|
} from './molecules/Dropdown'
|
|
151
177
|
|
|
152
178
|
// Organisms
|
|
153
|
-
export {
|
|
154
|
-
default as Card,
|
|
155
|
-
CardImage,
|
|
156
|
-
CardContent,
|
|
157
|
-
CardActions,
|
|
158
|
-
} from './organisms/Card'
|
|
159
|
-
export type {
|
|
160
|
-
CardProps,
|
|
161
|
-
CardImageProps,
|
|
162
|
-
CardContentProps,
|
|
163
|
-
CardActionsProps,
|
|
164
|
-
} from './organisms/Card'
|
|
165
179
|
|
|
166
180
|
// Hooks
|
|
167
181
|
export { default as useSlider } from './hooks/useSlider'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Story, Meta } from '@storybook/react'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
// Atoms
|
|
5
|
+
import Icon from '../../../atoms/Icon'
|
|
6
|
+
// Card components
|
|
7
|
+
import CardComponent from '../Card'
|
|
8
|
+
import CardImage from '../CardImage'
|
|
9
|
+
import CardContent from '../CardContent'
|
|
10
|
+
import CardActions from '../CardActions'
|
|
11
|
+
import type { CardProps } from '../Card'
|
|
12
|
+
import mdx from './Card.mdx'
|
|
13
|
+
|
|
14
|
+
const RightArrow = () => (
|
|
15
|
+
<svg
|
|
16
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
17
|
+
width="18"
|
|
18
|
+
height="18"
|
|
19
|
+
viewBox="0 0 18 18"
|
|
20
|
+
>
|
|
21
|
+
<path
|
|
22
|
+
d="M10.6553 3.40717C10.3624 3.11428 9.88756 3.11428 9.59467 3.40717C9.30178 3.70006 9.30178 4.17494 9.59467 4.46783L13.3768 8.25H2.8125C2.39829 8.25 2.0625 8.58579 2.0625 9C2.0625 9.41421 2.39829 9.75 2.8125 9.75H13.3768L9.59467 13.5322C9.30178 13.8251 9.30178 14.2999 9.59467 14.5928C9.88756 14.8857 10.3624 14.8857 10.6553 14.5928L15.7178 9.53033C15.8643 9.38388 15.9375 9.19194 15.9375 9C15.9375 8.89831 15.9173 8.80134 15.8806 8.71291C15.844 8.62445 15.7897 8.54158 15.7178 8.46967L10.6553 3.40717Z"
|
|
23
|
+
fill="currentColor"
|
|
24
|
+
/>
|
|
25
|
+
</svg>
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
const CardTemplate: Story<CardProps> = ({ testId }) => {
|
|
29
|
+
return (
|
|
30
|
+
<CardComponent testId={testId}>
|
|
31
|
+
<CardImage>
|
|
32
|
+
<img
|
|
33
|
+
alt="A person with hands on the pocket, carrying a round straw bag"
|
|
34
|
+
src="https://storecomponents.vtex.app/assets/fit-in/1280x613/center/middle/https%3A%2F%2Fstorecomponents.vtexassets.com%2Fassets%2Fvtex.file-manager-graphql%2Fimages%2Fedce348c-068c-4fb9-91f2-7d235d596e0f___b2822f893b14f87337d08f07f0e520ab.jpg"
|
|
35
|
+
/>
|
|
36
|
+
</CardImage>
|
|
37
|
+
<CardContent>
|
|
38
|
+
<h3>Get to know our next release</h3>
|
|
39
|
+
<p>
|
|
40
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Evehicula in
|
|
41
|
+
turpis sit ametl.{' '}
|
|
42
|
+
</p>
|
|
43
|
+
</CardContent>
|
|
44
|
+
<CardActions>
|
|
45
|
+
<a href="/">
|
|
46
|
+
Check new releases <Icon component={<RightArrow />} />
|
|
47
|
+
</a>
|
|
48
|
+
</CardActions>
|
|
49
|
+
</CardComponent>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const Card = CardTemplate.bind({})
|
|
54
|
+
Card.storyName = 'Card'
|
|
55
|
+
|
|
56
|
+
export default {
|
|
57
|
+
title: 'Molecules/Card',
|
|
58
|
+
parameters: {
|
|
59
|
+
docs: {
|
|
60
|
+
page: mdx,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
} as Meta
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { render } from '@testing-library/react'
|
|
2
|
+
import { axe } from 'jest-axe'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
|
|
5
|
+
import ProductCard from './ProductCard'
|
|
6
|
+
import ProductCardImage from './ProductCardImage'
|
|
7
|
+
import ProductCardContent from './ProductCardContent'
|
|
8
|
+
import ProductCardActions from './ProductCardActions'
|
|
9
|
+
|
|
10
|
+
const TestProductCard = () => {
|
|
11
|
+
return (
|
|
12
|
+
<ProductCard>
|
|
13
|
+
<ProductCardImage>
|
|
14
|
+
<div>An image</div>
|
|
15
|
+
</ProductCardImage>
|
|
16
|
+
<ProductCardContent>
|
|
17
|
+
<h3>A title</h3>
|
|
18
|
+
<p>A little text here: The quick brown fox jumps over the lazy dog.</p>
|
|
19
|
+
</ProductCardContent>
|
|
20
|
+
<ProductCardActions>
|
|
21
|
+
<button>A button</button>
|
|
22
|
+
</ProductCardActions>
|
|
23
|
+
</ProductCard>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
describe('ProductCard', () => {
|
|
28
|
+
let productCard: HTMLElement
|
|
29
|
+
let productCardImage: HTMLElement
|
|
30
|
+
let productCardContent: HTMLElement
|
|
31
|
+
let productCardActions: HTMLElement
|
|
32
|
+
let productCardContainer: HTMLElement
|
|
33
|
+
|
|
34
|
+
beforeEach(() => {
|
|
35
|
+
const { getByTestId, container } = render(<TestProductCard />)
|
|
36
|
+
|
|
37
|
+
productCardContainer = container
|
|
38
|
+
productCard = getByTestId('store-product-card')
|
|
39
|
+
productCardImage = getByTestId('store-product-card-image')
|
|
40
|
+
productCardContent = getByTestId('store-product-card-content')
|
|
41
|
+
productCardActions = getByTestId('store-product-card-actions')
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
describe('Data attributes', () => {
|
|
45
|
+
it('`ProductCard` component should have `data-store-product-card` attribute', () => {
|
|
46
|
+
expect(productCard).toHaveAttribute('data-store-product-card')
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
it('`ProductCardContent` component should have `data-product-card-content` attribute', () => {
|
|
50
|
+
expect(productCardContent).toHaveAttribute('data-product-card-content')
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
it('`ProductCardImage` component should have `data-product-card-image` attribute', () => {
|
|
54
|
+
expect(productCardImage).toHaveAttribute('data-product-card-image')
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
it('`ProductCardActions` component should have `data-product-card-actions` attribute', () => {
|
|
58
|
+
expect(productCardActions).toHaveAttribute('data-product-card-actions')
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
describe('Accessibility', () => {
|
|
63
|
+
it('should not have violations', async () => {
|
|
64
|
+
expect(await axe(productCardContainer)).toHaveNoViolations()
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
it('`ProductCard` component should be an `article`', () => {
|
|
68
|
+
expect(productCard.tagName).toEqual('ARTICLE')
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
it('`productCardContent` component should be an `section`', () => {
|
|
72
|
+
expect(productCardContent.tagName).toEqual('SECTION')
|
|
73
|
+
})
|
|
74
|
+
})
|
|
75
|
+
})
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react'
|
|
2
|
+
import type { HTMLAttributes } from 'react'
|
|
3
|
+
|
|
4
|
+
export interface ProductCardProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/**
|
|
6
|
+
* ID to find this component in testing tools (e.g.: cypress,
|
|
7
|
+
* testing-library, and jest).
|
|
8
|
+
*/
|
|
9
|
+
testId?: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const ProductCard = forwardRef<HTMLDivElement, ProductCardProps>(function Card(
|
|
13
|
+
{ testId = 'store-product-card', children, ...otherProps },
|
|
14
|
+
ref
|
|
15
|
+
) {
|
|
16
|
+
return (
|
|
17
|
+
<article
|
|
18
|
+
ref={ref}
|
|
19
|
+
data-store-product-card
|
|
20
|
+
data-testid={testId}
|
|
21
|
+
{...otherProps}
|
|
22
|
+
>
|
|
23
|
+
{children}
|
|
24
|
+
</article>
|
|
25
|
+
)
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
export default ProductCard
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react'
|
|
2
|
+
import type { HTMLAttributes } from 'react'
|
|
3
|
+
|
|
4
|
+
export interface ProductCardActionsProps
|
|
5
|
+
extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
/**
|
|
7
|
+
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
8
|
+
*/
|
|
9
|
+
testId?: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const ProductCardActions = forwardRef<HTMLDivElement, ProductCardActionsProps>(
|
|
13
|
+
function CardActions(
|
|
14
|
+
{ testId = 'store-product-card-actions', children, ...otherProps },
|
|
15
|
+
ref
|
|
16
|
+
) {
|
|
17
|
+
return (
|
|
18
|
+
<div
|
|
19
|
+
ref={ref}
|
|
20
|
+
data-product-card-actions
|
|
21
|
+
data-testid={testId}
|
|
22
|
+
{...otherProps}
|
|
23
|
+
>
|
|
24
|
+
{children}
|
|
25
|
+
</div>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
export default ProductCardActions
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react'
|
|
2
|
+
import React, { forwardRef } from 'react'
|
|
3
|
+
|
|
4
|
+
export interface ProductCardContentProps extends HTMLAttributes<HTMLElement> {
|
|
5
|
+
/**
|
|
6
|
+
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
7
|
+
*/
|
|
8
|
+
testId?: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const ProductCardContent = forwardRef<HTMLElement, ProductCardContentProps>(
|
|
12
|
+
function CardContent(
|
|
13
|
+
{ testId = 'store-product-card-content', children, ...otherProps },
|
|
14
|
+
ref
|
|
15
|
+
) {
|
|
16
|
+
return (
|
|
17
|
+
<section
|
|
18
|
+
ref={ref}
|
|
19
|
+
data-product-card-content
|
|
20
|
+
data-testid={testId}
|
|
21
|
+
{...otherProps}
|
|
22
|
+
>
|
|
23
|
+
{children}
|
|
24
|
+
</section>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
export default ProductCardContent
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'react'
|
|
2
|
+
import React, { forwardRef } from 'react'
|
|
3
|
+
|
|
4
|
+
export interface ProductCardImageProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/**
|
|
6
|
+
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
7
|
+
*/
|
|
8
|
+
testId?: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const ProductCardImage = forwardRef<HTMLDivElement, ProductCardImageProps>(
|
|
12
|
+
function ProductCardImage(
|
|
13
|
+
{ testId = 'store-product-card-image', children, ...otherProps },
|
|
14
|
+
ref
|
|
15
|
+
) {
|
|
16
|
+
return (
|
|
17
|
+
<div
|
|
18
|
+
ref={ref}
|
|
19
|
+
data-product-card-image
|
|
20
|
+
data-testid={testId}
|
|
21
|
+
{...otherProps}
|
|
22
|
+
>
|
|
23
|
+
{children}
|
|
24
|
+
</div>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
export default ProductCardImage
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { default } from './ProductCard'
|
|
2
|
+
export type { ProductCardProps } from './ProductCard'
|
|
3
|
+
|
|
4
|
+
export { default as ProductCardImage } from './ProductCardImage'
|
|
5
|
+
export type { ProductCardImageProps } from './ProductCardImage'
|
|
6
|
+
|
|
7
|
+
export { default as ProductCardContent } from './ProductCardContent'
|
|
8
|
+
export type { ProductCardContentProps } from './ProductCardContent'
|
|
9
|
+
|
|
10
|
+
export { default as ProductCardActions } from './ProductCardActions'
|
|
11
|
+
export type { ProductCardActionsProps } from './ProductCardActions'
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Canvas, Props, Story, ArgsTable } from '@storybook/addon-docs'
|
|
2
|
+
|
|
3
|
+
import ProductCard from '../ProductCard'
|
|
4
|
+
import ProductCardImage from '../ProductCardImage'
|
|
5
|
+
import ProductCardContent from '../ProductCardContent'
|
|
6
|
+
import ProductCardActions from '../ProductCardActions'
|
|
7
|
+
|
|
8
|
+
# ProductCard
|
|
9
|
+
|
|
10
|
+
<Canvas>
|
|
11
|
+
<Story id="molecules-productcard--product-card" />
|
|
12
|
+
</Canvas>
|
|
13
|
+
|
|
14
|
+
The `ProductCard` uses the [Compound Component](https://kentcdodds.com/blog/compound-components-with-react-hooks) pattern, its components are:
|
|
15
|
+
|
|
16
|
+
- `ProductCard`: the wrapper of the product card component;
|
|
17
|
+
- `ProductCardImage`: the wrapper component for the content's image;
|
|
18
|
+
- `ProductCardContent`: the wrapper component for the content's details;
|
|
19
|
+
- `ProductCardActions`: the wrapper component for the content's CTAs (call-to-action);
|
|
20
|
+
|
|
21
|
+
## Props
|
|
22
|
+
|
|
23
|
+
All Product Card related components support all attributes also supported by the `<div>` tag.
|
|
24
|
+
|
|
25
|
+
### `ProductCard`
|
|
26
|
+
|
|
27
|
+
<ArgsTable of={ProductCard} />
|
|
28
|
+
|
|
29
|
+
### `ProductCardImage`
|
|
30
|
+
|
|
31
|
+
<ArgsTable of={ProductCardImage} />
|
|
32
|
+
|
|
33
|
+
### `ProductCardContent`
|
|
34
|
+
|
|
35
|
+
<ArgsTable of={ProductCardContent} />
|
|
36
|
+
|
|
37
|
+
### `ProductCardActions`
|
|
38
|
+
|
|
39
|
+
<ArgsTable of={ProductCardActions} />
|
|
40
|
+
|
|
41
|
+
## CSS Selectors
|
|
42
|
+
|
|
43
|
+
```css
|
|
44
|
+
[data-store-product-card] {
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
[data-product-card-image] {
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
[data-product-card-content] {
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
[data-product-card-actions] {
|
|
54
|
+
}
|
|
55
|
+
```
|
|
@@ -6,23 +6,23 @@ import Price from '../../../atoms/Price'
|
|
|
6
6
|
import Badge from '../../../atoms/Badge'
|
|
7
7
|
import Button from '../../../atoms/Button'
|
|
8
8
|
// Card components
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import type {
|
|
14
|
-
import mdx from './
|
|
9
|
+
import ProductCardComponent from '../ProductCard'
|
|
10
|
+
import ProductCardImage from '../ProductCardImage'
|
|
11
|
+
import ProductCardContent from '../ProductCardContent'
|
|
12
|
+
import ProductCardActions from '../ProductCardActions'
|
|
13
|
+
import type { ProductCardProps } from '../ProductCard'
|
|
14
|
+
import mdx from './ProductCard.mdx'
|
|
15
15
|
|
|
16
|
-
const
|
|
16
|
+
const ProductCardTemplate: Story<ProductCardProps> = ({ testId }) => {
|
|
17
17
|
return (
|
|
18
|
-
<
|
|
19
|
-
<
|
|
18
|
+
<ProductCardComponent testId={testId}>
|
|
19
|
+
<ProductCardImage>
|
|
20
20
|
<img
|
|
21
21
|
alt="A vintage camera"
|
|
22
22
|
src="https://storecomponents.vtex.app/assets/fit-in/480x480/center/middle/https%3A%2F%2Fstorecomponents.vtexassets.com%2Farquivos%2Fids%2F155481%2FFrame-3.jpg%3Fv%3D636793814536230000"
|
|
23
23
|
/>
|
|
24
|
-
</
|
|
25
|
-
<
|
|
24
|
+
</ProductCardImage>
|
|
25
|
+
<ProductCardContent>
|
|
26
26
|
<h3>Vintage Top Camera</h3>
|
|
27
27
|
<div>
|
|
28
28
|
<Price
|
|
@@ -34,11 +34,11 @@ const CardTemplate: Story<CardProps> = ({ testId }) => {
|
|
|
34
34
|
<Price value={68.9} variant="selling" formatter={formatter} />
|
|
35
35
|
</div>
|
|
36
36
|
<Badge>15% OFF</Badge>
|
|
37
|
-
</
|
|
38
|
-
<
|
|
37
|
+
</ProductCardContent>
|
|
38
|
+
<ProductCardActions>
|
|
39
39
|
<Button onClick={() => null}>Add to Cart</Button>
|
|
40
|
-
</
|
|
41
|
-
</
|
|
40
|
+
</ProductCardActions>
|
|
41
|
+
</ProductCardComponent>
|
|
42
42
|
)
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -49,11 +49,11 @@ function formatter(price: number) {
|
|
|
49
49
|
}).format(price)
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
export const
|
|
53
|
-
|
|
52
|
+
export const ProductCard = ProductCardTemplate.bind({})
|
|
53
|
+
ProductCard.storyName = 'ProductCard'
|
|
54
54
|
|
|
55
55
|
export default {
|
|
56
|
-
title: '
|
|
56
|
+
title: 'Molecules/ProductCard',
|
|
57
57
|
parameters: {
|
|
58
58
|
docs: {
|
|
59
59
|
page: mdx,
|