@weareconceptstudio/account 0.2.5 → 0.2.6

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.
@@ -99,7 +99,7 @@ const AccountStyle = styled.section `
99
99
 
100
100
  //! Order History Individual Styles
101
101
  .order-info-wrap {
102
- .btn-wrap {
102
+ .back-to-list-btn-block {
103
103
  margin-bottom: var(--account_backToListMBot);
104
104
  }
105
105
 
@@ -42,6 +42,13 @@ const CartItemsStyle = styled.section `
42
42
 
43
43
  --account_cartItemSelectFixedWidth: calc(var(--sp9x) + var(--sp0-5x));
44
44
 
45
+ .mobile-info-wrap-title {
46
+ a,
47
+ button {
48
+ text-align: left;
49
+ }
50
+ }
51
+
45
52
  .line {
46
53
  width: calc(100% - var(--account_col1Distance));
47
54
  height: 2px;
@@ -1,6 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react';
2
2
  import { api } from '@weareconceptstudio/core';
3
- import { useAccountContext } from '../../../AccountProvider';
4
3
  //* Components
5
4
  import { AccountButton } from '../../../components';
6
5
  import OrderDetails from '../OrderDetails';
@@ -10,8 +9,6 @@ import { ShippingBillingInfo } from '../../address';
10
9
  import OrderIndividualTemplateStyle from './style';
11
10
  // TODO: status change
12
11
  const OrderIndividualTemplate = ({ uniqueKey }) => {
13
- const { useCart } = useAccountContext();
14
- const cartContext = useCart();
15
12
  const [data, setData] = useState();
16
13
  const [loading, setLoading] = useState(true);
17
14
  useEffect(() => {
@@ -20,17 +17,12 @@ const OrderIndividualTemplate = ({ uniqueKey }) => {
20
17
  setLoading(false);
21
18
  });
22
19
  }, [uniqueKey]);
23
- const handleReorder = () => {
24
- cartContext.reorder(data.id);
25
- };
26
20
  return !loading ? (React.createElement(OrderIndividualTemplateStyle, null,
27
21
  React.createElement("div", { className: `order-info-wrap` },
28
- React.createElement(AccountButton, { text: `backToList`, btnType: `green-large-text`, url: '/account/order-history/' }),
29
- React.createElement("div", null,
30
- React.createElement(AccountButton, { btnType: `purple-text`, text: 'reorder', onClick: handleReorder })),
22
+ React.createElement(AccountButton, { text: `backToList`, btnType: `green-large-text`, url: '/account/order-history/', className: `back-to-list-btn-block` }),
31
23
  React.createElement("div", { className: `details-shipping-billing-wrap` },
32
24
  React.createElement(OrderDetails, { className: `col-50`, ...data }),
33
25
  React.createElement(ShippingBillingInfo, { className: `col-50`, billing_address: data?.billingAddress, shipping_address: data?.shippingAddress })),
34
- data.items?.length > 0 ? (React.createElement(OrderedItems, { data: data.items, status: data.status })) : null))) : null;
26
+ React.createElement(OrderedItems, { data: data.items, dataId: data.id, status: data.status })))) : null;
35
27
  };
36
28
  export default OrderIndividualTemplate;
@@ -1,6 +1,7 @@
1
1
  export default OrderedItems;
2
- declare function OrderedItems({ data: items, status }: {
2
+ declare function OrderedItems({ data: items, status, dataId }: {
3
3
  data: any;
4
4
  status: any;
5
+ dataId: any;
5
6
  }): React.JSX.Element;
6
7
  import React from 'react';
@@ -4,9 +4,10 @@ import { handlePriceCheckFunc } from '../../../utils/_functions';
4
4
  import { useAccountContext } from '../../../AccountProvider';
5
5
  import { AccountButton } from '../../../components';
6
6
  import OrderedItemsStyle from './style';
7
- const OrderedItems = ({ data: items, status }) => {
7
+ const OrderedItems = ({ data: items, status, dataId }) => {
8
8
  const { winWidth } = useUi();
9
- const { currency, handleProductClick } = useAccountContext();
9
+ const { currency, handleProductClick, useCart } = useAccountContext();
10
+ const cartContext = useCart();
10
11
  //! Store order items
11
12
  const storeOrderedItems = useMemo(() => {
12
13
  return items?.length > 0
@@ -62,8 +63,13 @@ const OrderedItems = ({ data: items, status }) => {
62
63
  React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1`, text: handlePriceCheckFunc(item.total, currency) })))))))
63
64
  : null;
64
65
  }, [items, currency, winWidth, status, handleProductClick]);
65
- return (React.createElement(OrderedItemsStyle, { className: `ordered-items-wrapper` },
66
- React.createElement(Text, { className: 'account-p account-p1 account-font-bold account-primary-color1 ', text: 'orderItems' }),
66
+ const handleReorder = () => {
67
+ cartContext.reorder(dataId);
68
+ };
69
+ return items?.length > 0 ? (React.createElement(OrderedItemsStyle, { className: `ordered-items-wrapper` },
70
+ React.createElement("div", { className: 'order-flex-block' },
71
+ React.createElement(Text, { className: 'account-p account-p1 account-font-bold account-primary-color1 ', text: 'orderItems' }),
72
+ React.createElement(AccountButton, { text: 'reorder', onClick: handleReorder, className: 'reorder-btn' })),
67
73
  React.createElement("div", { className: 'line' }),
68
74
  React.createElement("div", { className: `order-items-table-wrap` },
69
75
  React.createElement("div", { className: `titles-wrap` },
@@ -75,6 +81,6 @@ const OrderedItems = ({ data: items, status }) => {
75
81
  React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1 nowrap align-right`, text: `price` })),
76
82
  React.createElement("div", { className: `title-wrap tl-col-4 title-item` },
77
83
  React.createElement(Text, { className: `account-p account-p3 account-font-bold account-primary-color1 nowrap align-right`, text: `total` }))),
78
- React.createElement("div", { className: 'items-wrap' }, storeOrderedItems))));
84
+ React.createElement("div", { className: 'items-wrap' }, storeOrderedItems)))) : null;
79
85
  };
80
86
  export default OrderedItems;
@@ -43,6 +43,21 @@ const OrderedItemsStyle = styled.div `
43
43
 
44
44
  margin-top: var(--account_orderItemsMarginTop);
45
45
 
46
+ .order-flex-block {
47
+ display: flex;
48
+ flex-wrap: wrap;
49
+ align-items: center;
50
+ justify-content: space-between;
51
+ gap: var(--sp1x);
52
+ }
53
+
54
+ .ordered-item-mobile-title {
55
+ a,
56
+ button {
57
+ text-align: left;
58
+ }
59
+ }
60
+
46
61
  .line {
47
62
  width: 100%;
48
63
  border-bottom: 2px solid var(--account_primaryColor1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weareconceptstudio/account",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "Concept Studio Account",
5
5
  "author": "Concept Studio",
6
6
  "license": "ISC",