Skip to content

Commit 355b7d5

Browse files
authored
Merge pull request #358 from w3bdesign/develop
Remove nested template literal
2 parents b9509ac + 570ce58 commit 355b7d5

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

components/Cart/AddToCartButton.component.jsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,15 @@ const AddToCartButton = ({ product }) => {
7070
addToCart();
7171
};
7272

73+
// Separate out conditions here for increased readability
74+
const fadeInButton = addToCartLoading && `animate__animated animate__fadeOutUp`;
75+
const fadeOutButton = showAddToCart && `animate__animated animate__fadeInDown`;
76+
7377
return (
7478
<>
7579
<button
7680
onClick={handleAddToCartClick}
77-
className={`px-4 py-2 font-bold bg-white border border-gray-400 border-solid rounded hover:bg-gray-400 ${
78-
addToCartLoading && `animate__animated animate__fadeOutUp`
79-
} ${showAddToCart && `animate__animated animate__fadeInDown`}`}
81+
className={`px-4 py-2 font-bold bg-white border border-gray-400 border-solid rounded hover:bg-gray-400 ${fadeInButton} ${fadeOutButton}`}
8082
>
8183
KJØP
8284
</button>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nextjs-woocommerce",
3-
"version": "1.0.12",
3+
"version": "1.0.13",
44
"description": "NextJS WooCommerce webshop",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)