Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: split Cart component into functional (Cart) and view parts (CartView) #140

Merged
merged 4 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 0 additions & 120 deletions _codux/board-wrappers/mock-ecom-api-context-provider.tsx

This file was deleted.

24 changes: 13 additions & 11 deletions _codux/boards/cart-item/cart-item.board.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { createBoard } from '@wixc3/react-board';
import { CartItem } from '../../../src/components/cart/cart-item/cart-item';
import { MockEcomAPIContextProvider } from '_codux/board-wrappers/mock-ecom-api-context-provider';
import { cart } from '@wix/ecom';

const mockCartItem: cart.LineItem = {
Expand All @@ -9,22 +8,25 @@ const mockCartItem: cart.LineItem = {
quantity: 1,
image: 'https://static.wixstatic.com/media/c837a6_18152edaef9940ca88f446ae94b48a47~mv2.jpg/v1/fill/w_824,h_1098,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/c837a6_18152edaef9940ca88f446ae94b48a47~mv2.jpg',
price: { formattedConvertedAmount: '$5.50' },
fullPrice: { formattedConvertedAmount: '$7.50' },
};

const noop = () => {};

export default createBoard({
name: 'CartItem',
Board: () => {
return (
<MockEcomAPIContextProvider>
<div style={{ padding: '0 20px' }}>
<CartItem
item={mockCartItem}
priceBreakdown={{
lineItemPrice: { formattedConvertedAmount: '$5.50' },
}}
/>
</div>
</MockEcomAPIContextProvider>
<div style={{ padding: '0 20px' }}>
<CartItem
item={mockCartItem}
priceBreakdown={{
lineItemPrice: { formattedConvertedAmount: '$5.50' },
}}
onQuantityChange={noop}
onRemove={noop}
/>
</div>
);
},
environmentProps: {
Expand Down
194 changes: 0 additions & 194 deletions _codux/mocks/fakers.ts

This file was deleted.

6 changes: 6 additions & 0 deletions app/routes/cart/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const mockCartItem: cart.LineItem = {
price: { formattedConvertedAmount: '$5.50' },
};

const noop = () => {};

export default function CartPage() {
return (
<div className={styles.page}>
Expand All @@ -24,12 +26,16 @@ export default function CartPage() {
priceBreakdown={{
lineItemPrice: { formattedConvertedAmount: '$5.50' },
}}
onQuantityChange={noop}
onRemove={noop}
/>
<CartItem
item={mockCartItem}
priceBreakdown={{
lineItemPrice: { formattedConvertedAmount: '$5.50' },
}}
onQuantityChange={noop}
onRemove={noop}
/>
</div>
</div>
Expand Down
Loading