@faststore/ui 1.3.40 → 1.3.44
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 +38 -0
- package/dist/atoms/Incentive/Incentive.d.ts +11 -0
- package/dist/atoms/Incentive/index.d.ts +2 -0
- package/dist/atoms/Incentive/stories/Incentive.stories.d.ts +4 -0
- package/dist/atoms/Incentive/stories/assets/Icons.d.ts +2 -0
- package/dist/index.d.ts +4 -0
- package/dist/molecules/QuantitySelector/QuantitySelector.d.ts +30 -0
- package/dist/molecules/QuantitySelector/index.d.ts +2 -0
- package/dist/molecules/QuantitySelector/stories/QuantitySelector.stories.d.ts +5 -0
- package/dist/molecules/QuantitySelector/stories/assets/Icons.d.ts +7 -0
- package/dist/ui.cjs.development.js +42 -0
- 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 +41 -1
- package/dist/ui.esm.js.map +1 -1
- package/package.json +3 -3
- package/src/atoms/Incentive/Incentive.test.tsx +36 -0
- package/src/atoms/Incentive/Incentive.tsx +23 -0
- package/src/atoms/Incentive/index.tsx +2 -0
- package/src/atoms/Incentive/stories/Incentive.mdx +24 -0
- package/src/atoms/Incentive/stories/Incentive.stories.tsx +26 -0
- package/src/atoms/Incentive/stories/assets/Icons.tsx +14 -0
- package/src/index.ts +6 -0
- package/src/molecules/QuantitySelector/QuantitySelector.test.tsx +93 -0
- package/src/molecules/QuantitySelector/QuantitySelector.tsx +82 -0
- package/src/molecules/QuantitySelector/index.ts +2 -0
- package/src/molecules/QuantitySelector/stories/QuantitySelector.mdx +26 -0
- package/src/molecules/QuantitySelector/stories/QuantitySelector.stories.tsx +77 -0
- package/src/molecules/QuantitySelector/stories/assets/Icons.tsx +52 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/ui",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.44",
|
|
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.3.
|
|
79
|
+
"@vtex/theme-b2c-tailwind": "^1.3.44",
|
|
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": "fe5354dc77b9f3e3166d36d0853c89620836a36c"
|
|
93
93
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { render } from '@testing-library/react'
|
|
2
|
+
import { axe } from 'jest-axe'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
|
|
5
|
+
import Incentive from './Incentive'
|
|
6
|
+
|
|
7
|
+
const TestIncentive = () => {
|
|
8
|
+
return (
|
|
9
|
+
<Incentive>
|
|
10
|
+
<span>Item title</span>
|
|
11
|
+
<span>Item description</span>
|
|
12
|
+
</Incentive>
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
describe('Incentive', () => {
|
|
17
|
+
let incentive: HTMLElement
|
|
18
|
+
|
|
19
|
+
beforeEach(() => {
|
|
20
|
+
const { getByTestId } = render(<TestIncentive />)
|
|
21
|
+
|
|
22
|
+
incentive = getByTestId('store-incentive')
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
describe('Data attributes', () => {
|
|
26
|
+
it('should have `data-store-incentive` attribute', () => {
|
|
27
|
+
expect(incentive).toHaveAttribute('data-store-incentive')
|
|
28
|
+
})
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
describe('Accessibility', () => {
|
|
32
|
+
it('should have no violations', async () => {
|
|
33
|
+
expect(await axe(incentive)).toHaveNoViolations()
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
})
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react'
|
|
2
|
+
import type { HTMLAttributes } from 'react'
|
|
3
|
+
|
|
4
|
+
export interface IncentiveProps 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 Incentive = forwardRef<HTMLDivElement, IncentiveProps>(function Incentive(
|
|
13
|
+
{ testId = 'store-incentive', children, ...otherProps },
|
|
14
|
+
ref
|
|
15
|
+
) {
|
|
16
|
+
return (
|
|
17
|
+
<div ref={ref} data-store-incentive data-testid={testId} {...otherProps}>
|
|
18
|
+
{children}
|
|
19
|
+
</div>
|
|
20
|
+
)
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
export default Incentive
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Canvas, Props, Story, ArgsTable } from '@storybook/addon-docs'
|
|
2
|
+
|
|
3
|
+
import Incentive from '../Incentive'
|
|
4
|
+
|
|
5
|
+
# Incentive
|
|
6
|
+
|
|
7
|
+
<Canvas>
|
|
8
|
+
<Story id="atoms-incentive--incentive" />
|
|
9
|
+
</Canvas>
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
`Incentive` component support all attributes also supported by the `<div>` tag.
|
|
14
|
+
|
|
15
|
+
Besides those attributes, the following props are also supported:
|
|
16
|
+
|
|
17
|
+
<ArgsTable of={Incentive} />
|
|
18
|
+
|
|
19
|
+
## CSS Selectors
|
|
20
|
+
|
|
21
|
+
```css
|
|
22
|
+
[data-store-incentive] {
|
|
23
|
+
}
|
|
24
|
+
```
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Story, Meta } from '@storybook/react'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
import { SafetyIcon } from './assets/Icons'
|
|
5
|
+
import type { IncentiveProps } from '../Incentive'
|
|
6
|
+
import Component from '../Incentive'
|
|
7
|
+
import mdx from './Incentive.mdx'
|
|
8
|
+
|
|
9
|
+
const IncentiveTemplate: Story<IncentiveProps> = ({ testId }) => (
|
|
10
|
+
<Component testId={testId}>
|
|
11
|
+
<SafetyIcon />
|
|
12
|
+
<span>Trusted by SafeCompany</span>
|
|
13
|
+
</Component>
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
export const Incentive = IncentiveTemplate.bind({})
|
|
17
|
+
Incentive.storyName = 'Incentive'
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
title: 'Atoms/Incentive',
|
|
21
|
+
parameters: {
|
|
22
|
+
docs: {
|
|
23
|
+
page: mdx,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
} as Meta
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
export function SafetyIcon() {
|
|
4
|
+
return (
|
|
5
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="35" height="35" fill="none">
|
|
6
|
+
<path
|
|
7
|
+
fillRule="evenodd"
|
|
8
|
+
clipRule="evenodd"
|
|
9
|
+
d="M6 7h20v7c0 10-8 14-10 14S6 24 6 14V7Zm0-2a2 2 0 0 0-2 2v7c0 11 10 15 11 16h2c1-1 11-5 11-16V7a2 2 0 0 0-2-2H6Zm16 9a1 1 0 0 0-1-2l-7 7-3-3a1 1 0 0 0-1 1l4 4h1l7-7Z"
|
|
10
|
+
fill="#323845"
|
|
11
|
+
/>
|
|
12
|
+
</svg>
|
|
13
|
+
)
|
|
14
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -50,6 +50,9 @@ export type { SpinnerProps } from './atoms/Spinner'
|
|
|
50
50
|
export { default as Label } from './atoms/Label'
|
|
51
51
|
export type { LabelProps } from './atoms/Label'
|
|
52
52
|
|
|
53
|
+
export { default as Incentive } from './atoms/Incentive'
|
|
54
|
+
export type { IncentiveProps } from './atoms/Incentive'
|
|
55
|
+
|
|
53
56
|
// Molecules
|
|
54
57
|
export { default as Bullets } from './molecules/Bullets'
|
|
55
58
|
export type { BulletsProps } from './molecules/Bullets'
|
|
@@ -130,6 +133,9 @@ export type { FormProps } from './molecules/Form'
|
|
|
130
133
|
export { default as Alert } from './molecules/Alert'
|
|
131
134
|
export type { AlertProps } from './molecules/Alert'
|
|
132
135
|
|
|
136
|
+
export { default as QuantitySelector } from './molecules/QuantitySelector'
|
|
137
|
+
export type { QuantitySelectorProps } from './molecules/QuantitySelector'
|
|
138
|
+
|
|
133
139
|
// Organisms
|
|
134
140
|
export {
|
|
135
141
|
default as Card,
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { render } from '@testing-library/react'
|
|
2
|
+
import React, { useState } from 'react'
|
|
3
|
+
import userEvent from '@testing-library/user-event'
|
|
4
|
+
import { axe } from 'jest-axe'
|
|
5
|
+
|
|
6
|
+
import QuantitySelector from '.'
|
|
7
|
+
|
|
8
|
+
describe('QuantitySelector', () => {
|
|
9
|
+
it('should render', () => {
|
|
10
|
+
const { getByTestId } = render(
|
|
11
|
+
<QuantitySelector
|
|
12
|
+
name="quantity-selector"
|
|
13
|
+
quantity={1}
|
|
14
|
+
leftButtonProps={{ icon: <span>-</span> }}
|
|
15
|
+
rightButtonProps={{ icon: <span>+</span> }}
|
|
16
|
+
inputProps={{ readOnly: true }}
|
|
17
|
+
/>
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
expect(getByTestId('store-quantity-selector')).toBeInTheDocument()
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
it('should render with the correct quantity', () => {
|
|
24
|
+
const { getByLabelText } = render(
|
|
25
|
+
<QuantitySelector
|
|
26
|
+
name="quantity-selector"
|
|
27
|
+
quantity={123}
|
|
28
|
+
leftButtonProps={{ icon: <span>-</span> }}
|
|
29
|
+
rightButtonProps={{ icon: <span>+</span> }}
|
|
30
|
+
inputProps={{ readOnly: true }}
|
|
31
|
+
/>
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
expect(getByLabelText('Quantity')).toHaveValue('123')
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
it('should update correctly according to event changes', () => {
|
|
38
|
+
const QuantitySelectorTest = () => {
|
|
39
|
+
const [quantity, setQuantity] = useState(1)
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<QuantitySelector
|
|
43
|
+
name="quantity-selector"
|
|
44
|
+
quantity={quantity}
|
|
45
|
+
leftButtonProps={{
|
|
46
|
+
icon: <span>-</span>,
|
|
47
|
+
onClick: () => {
|
|
48
|
+
setQuantity((curr) => curr - 1)
|
|
49
|
+
},
|
|
50
|
+
}}
|
|
51
|
+
rightButtonProps={{
|
|
52
|
+
icon: <span>+</span>,
|
|
53
|
+
onClick: () => {
|
|
54
|
+
setQuantity((curr) => curr + 1)
|
|
55
|
+
},
|
|
56
|
+
}}
|
|
57
|
+
inputProps={{ readOnly: true }}
|
|
58
|
+
/>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const { getByLabelText } = render(<QuantitySelectorTest />)
|
|
63
|
+
|
|
64
|
+
expect(getByLabelText('Quantity')).toHaveValue('1')
|
|
65
|
+
|
|
66
|
+
const rightButton = getByLabelText('Increment Quantity')
|
|
67
|
+
const leftButton = getByLabelText('Decrement Quantity')
|
|
68
|
+
|
|
69
|
+
userEvent.click(rightButton)
|
|
70
|
+
expect(getByLabelText('Quantity')).toHaveValue('2')
|
|
71
|
+
userEvent.click(leftButton)
|
|
72
|
+
expect(getByLabelText('Quantity')).toHaveValue('1')
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
describe('QuantitySelector Accessibility', () => {
|
|
76
|
+
it('should pass the AXE tests', async () => {
|
|
77
|
+
render(
|
|
78
|
+
<main>
|
|
79
|
+
<QuantitySelector
|
|
80
|
+
name="quantity-selector"
|
|
81
|
+
quantity={1}
|
|
82
|
+
leftButtonProps={{ icon: <span>-</span> }}
|
|
83
|
+
rightButtonProps={{ icon: <span>+</span> }}
|
|
84
|
+
inputProps={{ readOnly: true }}
|
|
85
|
+
/>
|
|
86
|
+
</main>
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
expect(await axe(document.body)).toHaveNoViolations()
|
|
90
|
+
expect(await axe(document.body)).toHaveNoIncompletes()
|
|
91
|
+
})
|
|
92
|
+
})
|
|
93
|
+
})
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { InputHTMLAttributes } from 'react'
|
|
2
|
+
import React, { forwardRef } from 'react'
|
|
3
|
+
|
|
4
|
+
import type { InputProps } from '../../atoms/Input'
|
|
5
|
+
import Input from '../../atoms/Input'
|
|
6
|
+
import type { IconButtonProps } from '../IconButton'
|
|
7
|
+
import IconButton from '../IconButton'
|
|
8
|
+
|
|
9
|
+
export interface QuantitySelectorProps
|
|
10
|
+
extends InputHTMLAttributes<HTMLDivElement> {
|
|
11
|
+
/**
|
|
12
|
+
* Sets the current value that should be displayed on the input at the center of the quantity selector.
|
|
13
|
+
*/
|
|
14
|
+
quantity: number | string
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Object with properties that will be passed forward the inner IconButton atom at the left of the input.
|
|
18
|
+
*/
|
|
19
|
+
leftButtonProps: IconButtonProps
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Object with properties that will be passed forward the inner Input atom between the two buttons.
|
|
23
|
+
*/
|
|
24
|
+
inputProps: InputProps
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Object with properties that will be passed forward the inner IconButton atom at the right of the input.
|
|
28
|
+
*/
|
|
29
|
+
rightButtonProps: IconButtonProps
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
33
|
+
*
|
|
34
|
+
* @default 'store-quantity-selector'
|
|
35
|
+
*/
|
|
36
|
+
testId?: string
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const QuantitySelector = forwardRef<HTMLDivElement, QuantitySelectorProps>(
|
|
40
|
+
function QuantitySelector(
|
|
41
|
+
{
|
|
42
|
+
quantity,
|
|
43
|
+
testId = 'store-quantity-selector',
|
|
44
|
+
leftButtonProps,
|
|
45
|
+
inputProps,
|
|
46
|
+
rightButtonProps,
|
|
47
|
+
...otherProps
|
|
48
|
+
}: QuantitySelectorProps,
|
|
49
|
+
ref
|
|
50
|
+
) {
|
|
51
|
+
return (
|
|
52
|
+
<div
|
|
53
|
+
data-store-quantity-selector
|
|
54
|
+
data-testid={testId}
|
|
55
|
+
ref={ref}
|
|
56
|
+
{...otherProps}
|
|
57
|
+
>
|
|
58
|
+
<IconButton
|
|
59
|
+
aria-controls="quantity-selector-input"
|
|
60
|
+
aria-label="Decrement Quantity"
|
|
61
|
+
data-quantity-selector-button="left"
|
|
62
|
+
{...leftButtonProps}
|
|
63
|
+
/>
|
|
64
|
+
<Input
|
|
65
|
+
aria-label="Quantity"
|
|
66
|
+
data-quantity-selector-input
|
|
67
|
+
id="quantity-selector-input"
|
|
68
|
+
value={quantity}
|
|
69
|
+
{...inputProps}
|
|
70
|
+
/>
|
|
71
|
+
<IconButton
|
|
72
|
+
aria-controls="quantity-selector-input"
|
|
73
|
+
aria-label="Increment Quantity"
|
|
74
|
+
data-quantity-selector-button="right"
|
|
75
|
+
{...rightButtonProps}
|
|
76
|
+
/>
|
|
77
|
+
</div>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
export default QuantitySelector
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Story, Canvas, ArgsTable } from '@storybook/addon-docs'
|
|
2
|
+
|
|
3
|
+
import QuantitySelector from '../QuantitySelector'
|
|
4
|
+
|
|
5
|
+
# QuantitySelector
|
|
6
|
+
|
|
7
|
+
## Default Style
|
|
8
|
+
|
|
9
|
+
<Canvas>
|
|
10
|
+
<Story id="molecules-quantityselector--default-style" />
|
|
11
|
+
</Canvas>
|
|
12
|
+
|
|
13
|
+
# Props
|
|
14
|
+
|
|
15
|
+
<ArgsTable of={QuantitySelector} />
|
|
16
|
+
|
|
17
|
+
# CSS Selectors
|
|
18
|
+
|
|
19
|
+
```css
|
|
20
|
+
[data-store-quantity-selector] {
|
|
21
|
+
}
|
|
22
|
+
[data-quantity-selector-input] {
|
|
23
|
+
}
|
|
24
|
+
[data-quantity-selector-button='(left|right)'] {
|
|
25
|
+
}
|
|
26
|
+
```
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { Meta, Story } from '@storybook/react'
|
|
2
|
+
import React, { useState } from 'react'
|
|
3
|
+
|
|
4
|
+
import type { QuantitySelectorProps } from '../QuantitySelector'
|
|
5
|
+
import Component from '../QuantitySelector'
|
|
6
|
+
import { PlusIcon, MinusIcon } from './assets/Icons'
|
|
7
|
+
import mdx from './QuantitySelector.mdx'
|
|
8
|
+
|
|
9
|
+
const MAX_QUANTITY = 10
|
|
10
|
+
const MIN_QUANTITY = 1
|
|
11
|
+
|
|
12
|
+
export const QuantitySelector: Story<QuantitySelectorProps> = () => {
|
|
13
|
+
const [quantity, setQuantity] = useState(MIN_QUANTITY)
|
|
14
|
+
|
|
15
|
+
function increase() {
|
|
16
|
+
setQuantity((currentQuantity) =>
|
|
17
|
+
validateQuantityBounds(currentQuantity + 1)
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function decrease() {
|
|
22
|
+
setQuantity((currentQuantity) =>
|
|
23
|
+
validateQuantityBounds(currentQuantity - 1)
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function isLeftDisabled(): boolean {
|
|
28
|
+
return quantity === MIN_QUANTITY
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function isRightDisabled(): boolean {
|
|
32
|
+
return quantity === MAX_QUANTITY
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function validateQuantityBounds(n: number): number {
|
|
36
|
+
return Math.min(Math.max(n, MIN_QUANTITY), MAX_QUANTITY)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function validateInput(e: React.FormEvent<HTMLInputElement>) {
|
|
40
|
+
const val = e.currentTarget.value
|
|
41
|
+
|
|
42
|
+
if (!Number.isNaN(Number(val))) {
|
|
43
|
+
setQuantity(validateQuantityBounds(Number(val)))
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<Component
|
|
49
|
+
quantity={quantity}
|
|
50
|
+
leftButtonProps={{
|
|
51
|
+
onClick: decrease,
|
|
52
|
+
disabled: isLeftDisabled(),
|
|
53
|
+
icon: <MinusIcon color={isLeftDisabled() ? '#898F9E' : '#2953B2'} />,
|
|
54
|
+
}}
|
|
55
|
+
rightButtonProps={{
|
|
56
|
+
onClick: increase,
|
|
57
|
+
disabled: isRightDisabled(),
|
|
58
|
+
icon: <PlusIcon color={isRightDisabled() ? '#898F9E' : '#2953B2'} />,
|
|
59
|
+
}}
|
|
60
|
+
inputProps={{
|
|
61
|
+
onChange: validateInput,
|
|
62
|
+
readOnly: false,
|
|
63
|
+
}}
|
|
64
|
+
/>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
QuantitySelector.storyName = 'QuantitySelector'
|
|
69
|
+
|
|
70
|
+
export default {
|
|
71
|
+
title: 'Molecules/QuantitySelector',
|
|
72
|
+
parameters: {
|
|
73
|
+
docs: {
|
|
74
|
+
page: mdx,
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
} as Meta
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
type QuantitySelectorIconProps = {
|
|
4
|
+
color: string
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function PlusIcon(props: QuantitySelectorIconProps) {
|
|
8
|
+
return (
|
|
9
|
+
<svg
|
|
10
|
+
width="32"
|
|
11
|
+
height="32"
|
|
12
|
+
viewBox="0 0 32 32"
|
|
13
|
+
fill="none"
|
|
14
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
+
>
|
|
16
|
+
<path
|
|
17
|
+
d="M11 16H21"
|
|
18
|
+
stroke={props.color}
|
|
19
|
+
strokeWidth="1.5"
|
|
20
|
+
strokeLinecap="round"
|
|
21
|
+
strokeLinejoin="round"
|
|
22
|
+
/>
|
|
23
|
+
<path
|
|
24
|
+
d="M16 11V21"
|
|
25
|
+
stroke={props.color}
|
|
26
|
+
strokeWidth="1.5"
|
|
27
|
+
strokeLinecap="round"
|
|
28
|
+
strokeLinejoin="round"
|
|
29
|
+
/>
|
|
30
|
+
</svg>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function MinusIcon(props: QuantitySelectorIconProps) {
|
|
35
|
+
return (
|
|
36
|
+
<svg
|
|
37
|
+
width="32"
|
|
38
|
+
height="32"
|
|
39
|
+
viewBox="0 0 32 32"
|
|
40
|
+
fill="none"
|
|
41
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
42
|
+
>
|
|
43
|
+
<path
|
|
44
|
+
d="M11 16H21"
|
|
45
|
+
stroke={props.color}
|
|
46
|
+
strokeWidth="1.5"
|
|
47
|
+
strokeLinecap="round"
|
|
48
|
+
strokeLinejoin="round"
|
|
49
|
+
/>
|
|
50
|
+
</svg>
|
|
51
|
+
)
|
|
52
|
+
}
|