@riosst100/pwa-marketplace 1.4.0 → 1.4.2
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/componentOverrideMapping.js +3 -1
- package/src/components/BrandSlider/brandSlider.js +91 -0
- package/src/components/BrandSlider/index.js +1 -0
- package/src/components/BrandSlider/item.js +43 -0
- package/src/components/CollectibleGameSets/collectibleGameSets.js +52 -0
- package/src/components/CollectibleGameSets/index.js +1 -0
- package/src/components/CollectibleGameSetsPage/collectibleGameSetsPage.js +10 -0
- package/src/components/CollectibleGameSetsPage/index.js +1 -0
- package/src/components/Divider/index.js +11 -0
- package/src/components/SellerDetail/sellerDetail.js +1 -1
- package/src/components/SellerReviewItem/sellerReviewItem.js +51 -51
- package/src/intercept.js +7 -0
- package/src/overwrites/peregrine/lib/talons/MegaMenu/megaMenu.gql.js +24 -0
- package/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.js +5 -0
- package/src/overwrites/venia-ui/lib/components/Button/button.js +100 -0
- package/src/overwrites/venia-ui/lib/components/Button/button.module.css +128 -0
- package/src/overwrites/venia-ui/lib/components/Button/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/MegaMenu/customSubmenuColumn.js +55 -0
- package/src/overwrites/venia-ui/lib/components/MegaMenu/customSubmenuColumn.module.css +29 -0
- package/src/overwrites/venia-ui/lib/components/MegaMenu/megaMenuItem.js +4 -1
- package/src/overwrites/venia-ui/lib/components/MegaMenu/shopByColumn.js +1 -1
- package/src/overwrites/venia-ui/lib/components/MegaMenu/submenu.js +3 -20
- package/src/overwrites/venia-ui/lib/components/MegaMenu/submenu.module.css +2 -1
- package/src/overwrites/venia-ui/lib/components/MegaMenu/submenuColumn.js +62 -14
- package/src/overwrites/venia-ui/lib/components/MegaMenu/submenuColumn.module.css +5 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/components/productReview.js +55 -0
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/productFullDetail.js +238 -46
- package/src/overwrites/venia-ui/lib/components/ProductFullDetail/productFullDetail.module.css +1 -5
- package/src/overwrites/venia-ui/lib/components/QuantityStepper/quantityStepper.js +23 -4
- package/src/overwrites/venia-ui/lib/components/QuantityStepper/quantityStepper.module.css +3 -7
- package/src/overwrites/venia-ui/lib/components/RichText/index.js +1 -0
- package/src/overwrites/venia-ui/lib/components/RichText/richText.js +21 -0
- package/src/overwrites/venia-ui/lib/components/RichText/richText.module.css +19 -0
- package/src/talons/CollectibleGameSets/collectibleGameSets.gql.js +27 -0
- package/src/talons/CollectibleGameSets/useCollectibleGameSets.js +65 -0
- package/src/theme/vars.js +2 -0
package/package.json
CHANGED
|
@@ -35,6 +35,8 @@ module.exports = componentOverrideMapping = {
|
|
|
35
35
|
[`@magento/venia-ui/lib/components/ProductFullDetail/index.js`]: '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/ProductFullDetail/index.js',
|
|
36
36
|
[`@magento/venia-ui/lib/components/ProductImageCarousel/index.js`]: '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/ProductImageCarousel/index.js',
|
|
37
37
|
[`@magento/venia-ui/lib/components/QuantityStepper/index.js`]: '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/QuantityStepper/index.js',
|
|
38
|
-
[`@magento/venia-ui/lib/components/RichContent/index.js`]: '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/RichContent/index.js',
|
|
38
|
+
// [`@magento/venia-ui/lib/components/RichContent/index.js`]: '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/RichContent/index.js',
|
|
39
39
|
[`@magento/venia-ui/lib/components/RadioGroup/radio.js`]: '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/RadioGroup/radio.js',
|
|
40
|
+
[`@magento/venia-ui/lib/components/Button/index.js`]: '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/Button/index.js',
|
|
41
|
+
[`@magento/venia-ui/lib/components/RichText/index.js`]: '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/RichText/index.js',
|
|
40
42
|
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Slider from "react-slick";
|
|
3
|
+
import { ArrowLeft2, ArrowRight2 } from 'iconsax-react';
|
|
4
|
+
import cn from 'classnames';
|
|
5
|
+
import Item from './item';
|
|
6
|
+
import { primary900 } from '@riosst100/pwa-marketplace/src/theme/vars';
|
|
7
|
+
|
|
8
|
+
const CustomArrow = (props) => {
|
|
9
|
+
const { isNext = true, onClick, className } = props;
|
|
10
|
+
return (
|
|
11
|
+
<span
|
|
12
|
+
className={cn(
|
|
13
|
+
className,
|
|
14
|
+
'custom_arrow rounded-full w-10 h-10 p-2.5 bg-white hover_!bg-white z-[1] !border !border-solid !border-gray-100 before_hidden',
|
|
15
|
+
isNext ? 'right-2 lg_right-4' : 'left-2 lg_left-4',
|
|
16
|
+
)}
|
|
17
|
+
onClick={onClick}
|
|
18
|
+
>
|
|
19
|
+
{isNext ? (
|
|
20
|
+
<ArrowRight2 className='' size="20" color={primary900} />
|
|
21
|
+
) : (
|
|
22
|
+
<ArrowLeft2 size="20" color={primary900} />
|
|
23
|
+
)}
|
|
24
|
+
</span>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const brandSlider = (props) => {
|
|
29
|
+
|
|
30
|
+
const settings = {
|
|
31
|
+
dots: false,
|
|
32
|
+
infinite: false,
|
|
33
|
+
speed: 500,
|
|
34
|
+
slidesToShow: 5,
|
|
35
|
+
slidesToScroll: 1,
|
|
36
|
+
nextArrow: <CustomArrow />,
|
|
37
|
+
prevArrow: <CustomArrow isNext={false} />,
|
|
38
|
+
centerPadding: "60px",
|
|
39
|
+
responsive: [
|
|
40
|
+
{
|
|
41
|
+
breakpoint: 1023,
|
|
42
|
+
settings: {
|
|
43
|
+
slidesToShow: 4,
|
|
44
|
+
slidesToScroll: 1,
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
breakpoint: 767,
|
|
49
|
+
settings: {
|
|
50
|
+
slidesToShow: 3,
|
|
51
|
+
slidesToScroll: 1,
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
breakpoint: 576,
|
|
56
|
+
settings: {
|
|
57
|
+
slidesToShow: 2,
|
|
58
|
+
slidesToScroll: 1
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
};
|
|
63
|
+
return (
|
|
64
|
+
<div className='brand_items-container flex flex-col gap-x-4 gap-y-5'>
|
|
65
|
+
<div className='text-[18px] font-medium'>
|
|
66
|
+
Shop by brands
|
|
67
|
+
</div>
|
|
68
|
+
<Slider {...settings}>
|
|
69
|
+
{[...Array(9)].map(() => {
|
|
70
|
+
return (
|
|
71
|
+
<Item />
|
|
72
|
+
)
|
|
73
|
+
})}
|
|
74
|
+
</Slider>
|
|
75
|
+
<style global jsx>
|
|
76
|
+
{`
|
|
77
|
+
.brand_items-container .slick-slider {
|
|
78
|
+
margin: 0 -8px;
|
|
79
|
+
}
|
|
80
|
+
@media only screen and (min-width: 1024px) {
|
|
81
|
+
.brand_items-container .slick-slider {
|
|
82
|
+
margin: 0 -16px;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
`}
|
|
86
|
+
</style>
|
|
87
|
+
</div>
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export default brandSlider
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './brandSlider';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
|
|
4
|
+
const Item = () => {
|
|
5
|
+
return (
|
|
6
|
+
<div className='brand-item-container px-2 lg_px-4'>
|
|
7
|
+
<div
|
|
8
|
+
className={cn(
|
|
9
|
+
'm-auto flex flex-col',
|
|
10
|
+
'w-full max-w-[250px]',
|
|
11
|
+
'relative rounded-lg border border-gray-100',
|
|
12
|
+
)}
|
|
13
|
+
>
|
|
14
|
+
<div className="brand_logo-wrapper w-full min-h-[120px] rounded-t-lg">
|
|
15
|
+
|
|
16
|
+
</div>
|
|
17
|
+
<div
|
|
18
|
+
className={cn(
|
|
19
|
+
'bg-darkblue-900 text-white uppercase text-lg font-bold leading-5 absolute',
|
|
20
|
+
'p-5 rounded-md top-1/2 left-1/2 -translate-y-1/2 -translate-x-1/2'
|
|
21
|
+
)}
|
|
22
|
+
>
|
|
23
|
+
TN
|
|
24
|
+
</div>
|
|
25
|
+
<div className='brand_name-wrapper flex items-center justify-center w-full min-h-[110px]'>
|
|
26
|
+
<span className='text-base font-medium'>
|
|
27
|
+
Tamashii Nations
|
|
28
|
+
</span>
|
|
29
|
+
</div>
|
|
30
|
+
<style global jsx>
|
|
31
|
+
{`
|
|
32
|
+
.brand_logo-wrapper {
|
|
33
|
+
background: rgb(217, 217, 217);
|
|
34
|
+
background: linear-gradient(180deg, rgb(217, 217, 217) 0%, rgba(217, 217, 217, 0) 100%);
|
|
35
|
+
}
|
|
36
|
+
`}
|
|
37
|
+
</style>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export default Item;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React, { Fragment } from 'react';
|
|
2
|
+
import { FormattedMessage } from 'react-intl';
|
|
3
|
+
import { useSeller } from '@riosst100/pwa-marketplace/src/talons/Seller/useSeller';
|
|
4
|
+
import ErrorView from '@magento/venia-ui/lib/components/ErrorView';
|
|
5
|
+
import { StoreTitle, Meta } from '@magento/venia-ui/lib/components/Head';
|
|
6
|
+
import { useCollectibleGameSets } from '@riosst100/pwa-marketplace/src/talons/CollectibleGameSets/useCollectibleGameSets';
|
|
7
|
+
|
|
8
|
+
const CollectibleGameSets = props => {
|
|
9
|
+
const talonProps = useCollectibleGameSets();
|
|
10
|
+
|
|
11
|
+
const { error, loading, collectibleGameSets } = talonProps;
|
|
12
|
+
|
|
13
|
+
if (loading && !collectibleGameSets)
|
|
14
|
+
return '';
|
|
15
|
+
// return <SellerShimmer />;
|
|
16
|
+
if (error && !collectibleGameSets) return <ErrorView />;
|
|
17
|
+
|
|
18
|
+
if (!collectibleGameSets) {
|
|
19
|
+
return (
|
|
20
|
+
<h1>
|
|
21
|
+
<FormattedMessage
|
|
22
|
+
id={'seller.notFound'}
|
|
23
|
+
defaultMessage={
|
|
24
|
+
'Seller Not Found.'
|
|
25
|
+
}
|
|
26
|
+
/>
|
|
27
|
+
</h1>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// console.log('SIPPPPPPPPPPPPPPPPPPP')
|
|
32
|
+
// console.log(collectibleGameSets)
|
|
33
|
+
|
|
34
|
+
const sets = collectibleGameSets.map((set, index) => {
|
|
35
|
+
const { card_set } = set;
|
|
36
|
+
return (
|
|
37
|
+
<>
|
|
38
|
+
<div><b>{card_set}</b></div>
|
|
39
|
+
</>
|
|
40
|
+
);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<Fragment>
|
|
46
|
+
<StoreTitle>Magic: The Gathering | All Sets</StoreTitle>
|
|
47
|
+
<div>{sets}</div>
|
|
48
|
+
</Fragment>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export default CollectibleGameSets;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './collectibleGameSets';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import CollectibleGameSets from '@riosst100/pwa-marketplace/src/components/CollectibleGameSets/collectibleGameSets';
|
|
3
|
+
|
|
4
|
+
const CollectibleGameSetsPage = () => {
|
|
5
|
+
return (
|
|
6
|
+
<CollectibleGameSets />
|
|
7
|
+
)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default CollectibleGameSetsPage;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './collectibleGameSetsPage';
|
|
@@ -3,61 +3,61 @@ import { Star1 } from 'iconsax-react';
|
|
|
3
3
|
|
|
4
4
|
const SellerReviewItem = ({ review }) => {
|
|
5
5
|
const rate1 = [];
|
|
6
|
-
if (review.rate1) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
6
|
+
// if (review.rate1) {
|
|
7
|
+
// for (let i = 1; i < review.rate1+1; i++) {
|
|
8
|
+
// rate1.push({
|
|
9
|
+
// 'num': i,
|
|
10
|
+
// 'star': true
|
|
11
|
+
// });
|
|
12
|
+
// }
|
|
13
|
+
|
|
14
|
+
// if (review.rate1 < 5) {
|
|
15
|
+
// for (let i = review.rate1+1; i < 5+1; i++) {
|
|
16
|
+
// rate1.push({
|
|
17
|
+
// 'num': i,
|
|
18
|
+
// 'star': false
|
|
19
|
+
// });
|
|
20
|
+
// }
|
|
21
|
+
// }
|
|
22
|
+
// }
|
|
23
23
|
|
|
24
24
|
const rate2 = [];
|
|
25
|
-
if (review.rate2) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
25
|
+
// if (review.rate2) {
|
|
26
|
+
// for (let i = 1; i < review.rate2+1; i++) {
|
|
27
|
+
// rate2.push({
|
|
28
|
+
// 'num': i,
|
|
29
|
+
// 'star': true
|
|
30
|
+
// });
|
|
31
|
+
// }
|
|
32
|
+
|
|
33
|
+
// if (review.rate2 < 5) {
|
|
34
|
+
// for (let i = review.rate2+1; i < 5+1; i++) {
|
|
35
|
+
// rate2.push({
|
|
36
|
+
// 'num': i,
|
|
37
|
+
// 'star': false
|
|
38
|
+
// });
|
|
39
|
+
// }
|
|
40
|
+
// }
|
|
41
|
+
// }
|
|
42
42
|
|
|
43
43
|
const rate3 = [];
|
|
44
|
-
if (review.rate3) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
44
|
+
// if (review.rate3) {
|
|
45
|
+
// for (let i = 1; i < review.rate3+1; i++) {
|
|
46
|
+
// rate3.push({
|
|
47
|
+
// 'num': i,
|
|
48
|
+
// 'star': true
|
|
49
|
+
// });
|
|
50
|
+
// }
|
|
51
|
+
|
|
52
|
+
// if (review.rate3 < 5) {
|
|
53
|
+
// for (let i = review.rate3+1; i < 5+1; i++) {
|
|
54
|
+
// rate3.push({
|
|
55
|
+
// 'num': i,
|
|
56
|
+
// 'star': false
|
|
57
|
+
// });
|
|
58
|
+
// }
|
|
59
|
+
// }
|
|
60
|
+
// }
|
|
61
61
|
|
|
62
62
|
const formatDate = (date) => {
|
|
63
63
|
const isoFormattedDate = date.replace(' ', 'T');
|
package/src/intercept.js
CHANGED
|
@@ -96,6 +96,13 @@ module.exports = targets => {
|
|
|
96
96
|
path: require.resolve("./components/SellerPage/index.js"),
|
|
97
97
|
authed: false,
|
|
98
98
|
},
|
|
99
|
+
{
|
|
100
|
+
exact: true,
|
|
101
|
+
name: "CollectibleGameSetsPage",
|
|
102
|
+
pattern: "/games/collectible-game/:urlKey/sets",
|
|
103
|
+
path: require.resolve("./components/CollectibleGameSetsPage/index.js"),
|
|
104
|
+
authed: false,
|
|
105
|
+
},
|
|
99
106
|
];
|
|
100
107
|
|
|
101
108
|
// Apply DefinePlugin using the results of the asynchronous operation
|
|
@@ -22,6 +22,14 @@ export const GET_MEGA_MENU = gql`
|
|
|
22
22
|
name
|
|
23
23
|
position
|
|
24
24
|
url_path
|
|
25
|
+
custom_submenu {
|
|
26
|
+
name
|
|
27
|
+
attribute {
|
|
28
|
+
code
|
|
29
|
+
value
|
|
30
|
+
}
|
|
31
|
+
path
|
|
32
|
+
}
|
|
25
33
|
shop_by {
|
|
26
34
|
name
|
|
27
35
|
code
|
|
@@ -38,6 +46,14 @@ export const GET_MEGA_MENU = gql`
|
|
|
38
46
|
name
|
|
39
47
|
position
|
|
40
48
|
url_path
|
|
49
|
+
custom_submenu {
|
|
50
|
+
name
|
|
51
|
+
attribute {
|
|
52
|
+
code
|
|
53
|
+
value
|
|
54
|
+
}
|
|
55
|
+
path
|
|
56
|
+
}
|
|
41
57
|
shop_by {
|
|
42
58
|
name
|
|
43
59
|
items {
|
|
@@ -52,6 +68,14 @@ export const GET_MEGA_MENU = gql`
|
|
|
52
68
|
name
|
|
53
69
|
position
|
|
54
70
|
url_path
|
|
71
|
+
custom_submenu {
|
|
72
|
+
name
|
|
73
|
+
attribute {
|
|
74
|
+
code
|
|
75
|
+
value
|
|
76
|
+
}
|
|
77
|
+
path
|
|
78
|
+
}
|
|
55
79
|
shop_by {
|
|
56
80
|
name
|
|
57
81
|
items {
|
|
@@ -27,6 +27,8 @@ import ProductListTab, { ProductListTabShimmer } from '@riosst100/pwa-marketplac
|
|
|
27
27
|
import SubCategory from '@riosst100/pwa-marketplace/src/components/SubCategory/subCategory';
|
|
28
28
|
import AttributesBlock from '@riosst100/pwa-marketplace/src/components/AttributesBlock/attributesBlock';
|
|
29
29
|
|
|
30
|
+
import BrandSlider from '@riosst100/pwa-marketplace/src/components/BrandSlider';
|
|
31
|
+
|
|
30
32
|
const FilterModal = React.lazy(() => import('@magento/venia-ui/lib/components/FilterModal'));
|
|
31
33
|
const FilterSidebar = React.lazy(() =>
|
|
32
34
|
import('@magento/venia-ui/lib/components/FilterSidebar')
|
|
@@ -183,6 +185,9 @@ const CategoryContent = props => {
|
|
|
183
185
|
</div>
|
|
184
186
|
<SubCategory children={children} />
|
|
185
187
|
<AttributesBlock category={category} attributesBlock={attributesBlock} />
|
|
188
|
+
<section className='category_brand-slider my-5'>
|
|
189
|
+
<BrandSlider />
|
|
190
|
+
</section>
|
|
186
191
|
<div className={classes.contentWrapper}>
|
|
187
192
|
<div ref={sidebarRef} className={classes.sidebar}>
|
|
188
193
|
<Suspense fallback={<FilterSidebarShimmer />}>
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
|
+
import { useButton } from 'react-aria';
|
|
3
|
+
import { oneOf, shape, string, bool } from 'prop-types';
|
|
4
|
+
|
|
5
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
6
|
+
import defaultClasses from './button.module.css';
|
|
7
|
+
import cn from 'classnames';
|
|
8
|
+
|
|
9
|
+
const getRootClassName = (priority, negative) =>
|
|
10
|
+
`root_${priority}Priority${negative ? 'Negative' : ''}`;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A component for buttons.
|
|
14
|
+
*
|
|
15
|
+
* @typedef Button
|
|
16
|
+
* @kind functional component
|
|
17
|
+
*
|
|
18
|
+
* @param {props} props React component props
|
|
19
|
+
*
|
|
20
|
+
* @returns {React.Element} A React component that displays a single button.
|
|
21
|
+
*/
|
|
22
|
+
const Button = props => {
|
|
23
|
+
const {
|
|
24
|
+
children,
|
|
25
|
+
classes: propClasses,
|
|
26
|
+
priority,
|
|
27
|
+
negative,
|
|
28
|
+
disabled,
|
|
29
|
+
onPress,
|
|
30
|
+
...restProps
|
|
31
|
+
} = props;
|
|
32
|
+
|
|
33
|
+
const buttonRef = useRef();
|
|
34
|
+
|
|
35
|
+
const { buttonProps } = useButton(
|
|
36
|
+
{
|
|
37
|
+
isDisabled: disabled,
|
|
38
|
+
onPress,
|
|
39
|
+
...restProps
|
|
40
|
+
},
|
|
41
|
+
buttonRef
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const classes = useStyle(defaultClasses, propClasses);
|
|
45
|
+
const rootClassName = classes[getRootClassName(priority, negative)];
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<button
|
|
49
|
+
ref={buttonRef}
|
|
50
|
+
className={rootClassName}
|
|
51
|
+
{...buttonProps}
|
|
52
|
+
{...restProps}
|
|
53
|
+
>
|
|
54
|
+
<span className={cn(classes.content)}>{children}</span>
|
|
55
|
+
</button>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Props for {@link Button}
|
|
61
|
+
*
|
|
62
|
+
* @typedef props
|
|
63
|
+
*
|
|
64
|
+
* @property {Object} classes An object containing the class names for the
|
|
65
|
+
* Button component.
|
|
66
|
+
* @property {string} classes.content classes for the button content
|
|
67
|
+
* @property {string} classes.root classes for root container
|
|
68
|
+
* @property {string} classes.root_highPriority classes for Button if
|
|
69
|
+
* high priority.
|
|
70
|
+
* @property {string} classes.root_lowPriority classes for Button if
|
|
71
|
+
* low priority.
|
|
72
|
+
* @property {string} classes.root_normalPriority classes for Button if
|
|
73
|
+
* normal priority.
|
|
74
|
+
* @property {string} priority the priority/importance of the Button
|
|
75
|
+
* @property {string} type the type of the Button
|
|
76
|
+
* @property {bool} negative whether the button should be displayed in red for a negative action
|
|
77
|
+
* @property {bool} disabled is the button disabled
|
|
78
|
+
*/
|
|
79
|
+
Button.propTypes = {
|
|
80
|
+
classes: shape({
|
|
81
|
+
content: string,
|
|
82
|
+
root: string,
|
|
83
|
+
root_highPriority: string,
|
|
84
|
+
root_lowPriority: string,
|
|
85
|
+
root_normalPriority: string
|
|
86
|
+
}),
|
|
87
|
+
priority: oneOf(['high', 'low', 'normal']).isRequired,
|
|
88
|
+
type: oneOf(['button', 'reset', 'submit']).isRequired,
|
|
89
|
+
negative: bool,
|
|
90
|
+
disabled: bool
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
Button.defaultProps = {
|
|
94
|
+
priority: 'normal',
|
|
95
|
+
type: 'button',
|
|
96
|
+
negative: false,
|
|
97
|
+
disabled: false
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export default Button;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
.root {
|
|
2
|
+
composes: border from global;
|
|
3
|
+
composes: border-solid from global;
|
|
4
|
+
composes: cursor-pointer from global;
|
|
5
|
+
composes: font-bold from global;
|
|
6
|
+
composes: inline-flex from global;
|
|
7
|
+
composes: items-center from global;
|
|
8
|
+
composes: justify-center from global;
|
|
9
|
+
composes: max-w-full from global;
|
|
10
|
+
composes: min-w-[10rem] from global;
|
|
11
|
+
composes: outline-none from global;
|
|
12
|
+
composes: pointer-events-auto from global;
|
|
13
|
+
composes: px-sm from global;
|
|
14
|
+
composes: rounded-full from global;
|
|
15
|
+
composes: text-center from global;
|
|
16
|
+
composes: text-sm from global;
|
|
17
|
+
composes: uppercase from global;
|
|
18
|
+
composes: py-2 from global;
|
|
19
|
+
|
|
20
|
+
transition-duration: 256ms;
|
|
21
|
+
transition-property: background-color, border-color, color;
|
|
22
|
+
transition-timing-function: var(--venia-global-anim-standard);
|
|
23
|
+
|
|
24
|
+
composes: disabled_bg-gray-400 from global;
|
|
25
|
+
composes: disabled_border-gray-400 from global;
|
|
26
|
+
composes: disabled_opacity-50 from global;
|
|
27
|
+
composes: disabled_pointer-events-none from global;
|
|
28
|
+
composes: disabled_text-white from global;
|
|
29
|
+
|
|
30
|
+
composes: focus_shadow-inputFocus from global;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.root:active {
|
|
34
|
+
transition-duration: 128ms;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Some browsers retain the :hover state after a click, this ensures if a button becomes disabled after
|
|
39
|
+
* being clicked it will be visually disabled.
|
|
40
|
+
*/
|
|
41
|
+
.root:hover:disabled {
|
|
42
|
+
/* TODO @TW: cannot compose. This may not be possible with two variants. */
|
|
43
|
+
pointer-events: none;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.root_lowPriority {
|
|
47
|
+
composes: root;
|
|
48
|
+
|
|
49
|
+
composes: bg-transparent from global;
|
|
50
|
+
composes: border-gray-700 from global;
|
|
51
|
+
composes: text-gray-700 from global;
|
|
52
|
+
|
|
53
|
+
composes: active_border-gray-800 from global;
|
|
54
|
+
composes: active_text-gray-800 from global;
|
|
55
|
+
|
|
56
|
+
composes: hover_border-gray-800 from global;
|
|
57
|
+
composes: hover_text-gray-800 from global;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.root_normalPriority {
|
|
61
|
+
composes: root;
|
|
62
|
+
|
|
63
|
+
composes: bg-transparent from global;
|
|
64
|
+
composes: border-brand-dark from global;
|
|
65
|
+
composes: text-brand-dark from global;
|
|
66
|
+
|
|
67
|
+
composes: active_border-brand-darkest from global;
|
|
68
|
+
composes: active_text-brand-darkest from global;
|
|
69
|
+
|
|
70
|
+
composes: hover_border-brand-darkest from global;
|
|
71
|
+
composes: hover_text-brand-darkest from global;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.root_highPriority {
|
|
75
|
+
composes: root;
|
|
76
|
+
|
|
77
|
+
composes: bg-brand-dark from global;
|
|
78
|
+
composes: border-brand-dark from global;
|
|
79
|
+
composes: text-white from global;
|
|
80
|
+
|
|
81
|
+
composes: active_bg-brand-darkest from global;
|
|
82
|
+
composes: active_border-brand-darkest from global;
|
|
83
|
+
composes: active_text-white from global;
|
|
84
|
+
|
|
85
|
+
composes: hover_bg-brand-darkest from global;
|
|
86
|
+
composes: hover_border-brand-darkest from global;
|
|
87
|
+
composes: hover_text-white from global;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.root_lowPriorityNegative,
|
|
91
|
+
.root_normalPriorityNegative {
|
|
92
|
+
composes: root;
|
|
93
|
+
|
|
94
|
+
composes: bg-transparent from global;
|
|
95
|
+
composes: border-red-600 from global;
|
|
96
|
+
composes: text-red-600 from global;
|
|
97
|
+
|
|
98
|
+
composes: active_border-red-700 from global;
|
|
99
|
+
composes: active_text-red-700 from global;
|
|
100
|
+
|
|
101
|
+
composes: hover_border-red-700 from global;
|
|
102
|
+
composes: hover_text-red-700 from global;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.root_highPriorityNegative {
|
|
106
|
+
composes: root;
|
|
107
|
+
|
|
108
|
+
composes: bg-red-600 from global;
|
|
109
|
+
composes: border-red-600 from global;
|
|
110
|
+
composes: text-white from global;
|
|
111
|
+
|
|
112
|
+
composes: active_bg-red-700 from global;
|
|
113
|
+
composes: active_border-red-700 from global;
|
|
114
|
+
composes: active_text-white from global;
|
|
115
|
+
|
|
116
|
+
composes: hover_bg-red-700 from global;
|
|
117
|
+
composes: hover_border-red-700 from global;
|
|
118
|
+
composes: hover_text-white from global;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.content {
|
|
122
|
+
composes: gap-1.5 from global;
|
|
123
|
+
composes: grid-flow-col from global;
|
|
124
|
+
composes: inline-grid from global;
|
|
125
|
+
composes: items-center from global;
|
|
126
|
+
composes: justify-center from global;
|
|
127
|
+
composes: justify-items-center from global;
|
|
128
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './button';
|