-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1.1.0 (compatibility with venia 12)
- Loading branch information
Showing
7 changed files
with
71 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
.giftCardOptionsTitle { | ||
composes: title from '~@magento/venia-ui/lib/components/ProductOptions/option.css'; | ||
composes: title from '~@magento/venia-ui/lib/components/ProductOptions/option.module.css'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/features/Category/modify/targets/wrapUseAddToCartButton.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import {useHistory} from "react-router-dom"; | ||
import {useCallback} from "react"; | ||
|
||
const wrapUseAddToCartButton = (original) => { | ||
return function useAddToCartButton (props, ...restArgs) { | ||
const { ...defaultReturnData } = original( | ||
props, | ||
...restArgs | ||
); | ||
|
||
const { item } = props; | ||
const isInStock = item.stock_status === 'IN_STOCK'; | ||
const productType = item.type_id; | ||
const history = useHistory(); | ||
|
||
const handleAddToCart = useCallback(() => { | ||
history.push(`${item.url_key}.html`); | ||
}, [history, item.url_key]); | ||
|
||
if (productType !== "mageworx_giftcards") { | ||
return defaultReturnData; | ||
} | ||
|
||
return { | ||
...defaultReturnData, | ||
isDisabled: !isInStock, | ||
handleAddToCart | ||
}; | ||
}; | ||
}; | ||
|
||
export default wrapUseAddToCartButton; |
19 changes: 19 additions & 0 deletions
19
src/features/Category/modify/targets/wrapUseGalleryItem.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const wrapUseGalleryItem = (original) => { | ||
return function useGalleryItem (props, ...restArgs) { | ||
const { ...defaultReturnData } = original( | ||
props, | ||
...restArgs | ||
); | ||
|
||
const { item } = props; | ||
const productType = item ? item.__typename : null; | ||
const isSupportedProductType = defaultReturnData.isSupportedProductType || productType === "MageWorxGiftCards"; | ||
|
||
return { | ||
...defaultReturnData, | ||
isSupportedProductType | ||
}; | ||
}; | ||
}; | ||
|
||
export default wrapUseGalleryItem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters