diff --git a/src/App.css b/src/App.css index 04ebe4c..810e639 100644 --- a/src/App.css +++ b/src/App.css @@ -64,6 +64,11 @@ body { /* removed two-column layout; reverted to single column */ +/* Ensure sticky cart bar stays above item overlays */ +.StickyCartBar { + z-index: 3000 !important; +} + .App-link { color: #61dafb; } diff --git a/src/components/Item.js b/src/components/Item.js index 7d48540..1e4234e 100644 --- a/src/components/Item.js +++ b/src/components/Item.js @@ -4,6 +4,7 @@ const Item = ({ blank, forCart, forInvoice, + portrait, name: initialName, description: initialDescription, price: initialPrice, @@ -53,10 +54,10 @@ const Item = ({ }; const handleCreate = () => { - handleCreateItem(itemName, itemPrice, selectedImage, previewUrl); + handleCreateItem(itemName, itemPrice, selectedImage, previewUrl, itemDescription, promoPrice); }; const handleUpdate = () => { - handleUpdateItem(itemName, itemPrice, selectedImage, previewUrl); + handleUpdateItem(itemName, itemPrice, selectedImage, itemDescription, promoPrice); }; const handleRemoveClick = () => { @@ -94,21 +95,57 @@ const Item = ({ setItemName(event.target.value); }; + const toTitleCase = (str) => { + if (!str) return str; + return String(str) + .toLowerCase() + .replace(/(^|[\s\-/'])([a-zA-Z\u00C0-\u024F])/g, (m, p1, p2) => p1 + p2.toUpperCase()); + }; + + const displayName = toTitleCase(itemName); + return ( -
-
+
+
{!forInvoice && ( - { - currentTarget.onerror = null; - currentTarget.src = - "https://png.pngtree.com/png-vector/20221125/ourmid/pngtree-no-image-available-icon-flatvector-illustration-pic-design-profile-vector-png-image_40966566.jpg"; - }} - alt={itemName} - style={{ filter: !isAvailable ? "grayscale(100%)" : "none" }} - className={styles.imageContainer} - /> +
+ { + currentTarget.onerror = null; + currentTarget.src = + "https://png.pngtree.com/png-vector/20221125/ourmid/pngtree-no-image-available-icon-flatvector-illustration-pic-design-profile-vector-png-image_40966566.jpg"; + }} + alt={itemName} + style={{ filter: !isAvailable ? "grayscale(100%)" : "none" }} + className={styles.imageContainer} + /> + {promoPrice && promoPrice != 0 && promoPrice != '' && ( +
Promo
+ )} + {portrait && ( + <> +
{displayName}
+
+
+ {(promoPrice && promoPrice != 0 && promoPrice != '') ? ( + <> + Rp {formatCurrency(initialPrice)} + Rp {formatCurrency(promoPrice)} + + ) : ( + Rp {formatCurrency(initialPrice)} + )} +
+
+ + {itemQty} + +
+
+ + )} +
)}
{forInvoice && @@ -129,37 +166,27 @@ const Item = ({ } - {/* */} -
-

{itemName}

- {!forInvoice && ( -
- {promoPrice && promoPrice != 0 && promoPrice != '' ? ( - <> -
- Promo {(((initialPrice - promoPrice) / initialPrice) * 100).toFixed(0)}% -
-
- Rp {formatCurrency(promoPrice)} - Rp {formatCurrency(initialPrice)} -
- - ) : ( - Rp {formatCurrency(initialPrice)} - )} -
- )} -
+ {/* Title under image for portrait, non-overlay */} + {portrait && null} + {!portrait && ( +
+

{displayName}

+ {!forInvoice && ( +
+ {promoPrice && promoPrice != 0 && promoPrice != '' ? ( + <> +
+ Rp {formatCurrency(promoPrice)} + Rp {formatCurrency(initialPrice)} +
+ + ) : ( + Rp {formatCurrency(initialPrice)} + )} +
+ )} +
+ )} {forInvoice && ( <>

x

@@ -168,30 +195,30 @@ const Item = ({ )} {!forInvoice && ( - !isBeingEdit && itemQty > 0 ? ( -
-
- - {!blank && !isBeingEdit ? ( - {itemQty} - ) : ( - - )} - + portrait ? ( + (blank || isBeingEdit) ? ( +
+
-
- ) : !blank && !isBeingEdit ? ( -
- -
+ ) : null ) : ( -
- -
+ !isBeingEdit ? ( +
+
+ + {itemQty} + +
+
+ ) : ( +
+ +
+ ) ) )} @@ -204,19 +231,10 @@ const Item = ({ ⓧ
)} - {/* {blank && ( - - )} */}
- {itemDescription && itemDescription != 'undefined' && itemDescription?.length ? ( -
-

{itemDescription}

-
- ) : null} + {null}
); }; -export default Item; +export default Item; \ No newline at end of file diff --git a/src/components/Item.module.css b/src/components/Item.module.css index 0a74e5f..854cec0 100644 --- a/src/components/Item.module.css +++ b/src/components/Item.module.css @@ -1,7 +1,6 @@ .itemContainer { display: flex; flex-direction: column; - /* gap: 10px; */ } .item { @@ -9,24 +8,40 @@ align-items: center; justify-content: space-between; width: 100%; - gap: 10px; - padding: 8px 10px; - margin: 6px 0; + gap: 8px; /* Increased gap for better spacing */ + padding: 6px 8px; /* Increased padding for better touch targets */ + margin: 8px 0; /* Increased margin for better separation */ border: 1px solid #e3ece6; - border-radius: 12px; + border-radius: 8px; /* Slightly increased border radius */ background: var(--brand-sage-50, #F0F6F2); box-shadow: 0 1px 3px rgba(0,0,0,0.03); box-sizing: border-box; transition: box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.2s ease; } -.item:hover { box-shadow: 0 4px 10px rgba(0,0,0,0.08); border-color: #d9e6de; } +.item:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); border-color: #d9e6de; } -.item:not(.itemInvoice) { - /* border-top: 2px solid #00000017; */ +/* Portrait variant for cafe page grid */ +.itemPortrait { + flex-direction: column; + align-items: stretch; + padding: 0; + margin: 0; + border: none; + background: transparent; + box-shadow: none; } +.imageWrap { position: relative; border-radius: 8px; overflow: hidden; box-shadow: 0 6px 18px rgba(0,0,0,0.12); } +.imageContainer { display: block; width: 100%; height: 100%; object-fit: cover; } +.itemPortrait .imageWrap { width: 100%; height: auto; aspect-ratio: 1 / 1; } +.itemPortrait .imageContainer { border-radius: 6px; } +.itemPortrait .itemDetails { align-items: flex-start; text-align: left; gap: 8px; } /* Increased gap */ +.itemPortrait .itemQty { justify-content: flex-start; } + +.itemPortrait .title { font-size: 14px; } /* Increased font size */ +.itemPortrait .priceNow { font-size: 13px; } /* Increased font size */ .notLast{ - padding-bottom: 10px; + padding-bottom: 12px; /* Increased padding */ border-bottom: 2px solid #00000017; } @@ -34,14 +49,14 @@ flex-direction: row; align-items: center; justify-content: space-around; - font-size: 18px; + font-size: 20px; /* Increased font size */ margin-top: 0px; margin-bottom: 0px; padding-top: 0px; } .itemInvoice:last-child { - margin-bottom: 0; /* Remove margin-bottom for the last child */ + margin-bottom: 0; } .itemImage { @@ -49,29 +64,29 @@ height: 100%; } -.imageContainer { +.item:not(.itemPortrait) .imageContainer { position: relative; - width: clamp(68px, 18vw, 96px); - height: clamp(68px, 18vw, 96px); - border-radius: 10px; + width: clamp(80px, 20vw, 110px); /* Increased size */ + height: clamp(80px, 20vw, 110px); /* Increased size */ + border-radius: 12px; /* Increased border radius */ object-fit: cover; } .overlay { position: absolute; - top: 15px; - left: 8px; - right: 8px; - bottom: 15px; + top: 18px; /* Increased top position */ + left: 10px; /* Increased left position */ + right: 10px; /* Increased right position */ + bottom: 18px; /* Increased bottom position */ background-color: rgba(0, 0, 0, 0.5); color: white; display: flex; justify-content: center; align-items: center; - border-radius: 20px; + border-radius: 20px; /* Increased border radius */ cursor: pointer; transition: background-color 0.3s ease; - font-size: 3.3vw; + font-size: 3.8vw; /* Increased font size */ } .overlay:hover { @@ -87,19 +102,19 @@ flex-direction: column; justify-content: center; align-items: stretch; - gap: 6px; - margin-left: 6px; - margin-right: 6px; + gap: 8px; /* Increased gap */ + margin-left: 8px; /* Increased margin */ + margin-right: 8px; /* Increased margin */ flex: 1; min-width: 0; } -.infoRow { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; } +.infoRow { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; } /* Increased gap */ .itemInvoiceDetails { display: flex; flex-direction: column; justify-content: space-between; - margin-left: 10px; + margin-left: 12px; /* Increased margin */ margin-top: -15px; flex-grow: 1; } @@ -107,20 +122,20 @@ .itemName { font-family: "Plus Jakarta Sans", sans-serif; font-style: normal; - width: calc(100% - 15px); /* Adjust the width to prevent overflow */ - font-size: 5vw; + width: calc(100% - 18px); /* Adjusted width */ + font-size: 5.5vw; /* Increased font size */ font-weight: 500; margin-top: 0; - margin: 0 5px; + margin: 0 6px; /* Increased margin */ color: rgba(88, 55, 50, 1); background-color: transparent; text-transform: capitalize; } .itemInvoiceName { - width: calc(260% - 15px); + width: calc(280% - 18px); /* Adjusted width */ background-color: transparent; - font-size: 1.3rem; + font-size: 1.4rem; /* Increased font size */ font-weight: 500; } @@ -138,8 +153,8 @@ font-family: "Plus Jakarta Sans", sans-serif; font-style: normal; font-weight: 600; - font-size: 0.9rem; - margin-left: 5px; + font-size: 1rem; /* Increased font size */ + margin-left: 6px; /* Increased margin */ color: #d9c61c; text-align: right; margin-top: 22px; @@ -149,18 +164,18 @@ display: flex; align-items: center; justify-content: flex-end; - gap: 8px; - min-height: 32px; + gap: 10px; /* Increased gap */ + min-height: 36px; /* Increased height */ } .itemQtyValue { font-family: "Plus Jakarta Sans", sans-serif; font-style: normal; font-weight: 600; - margin-top: 19px; - margin-left: 1px; - margin-right: 1px; - width: 25px; + margin-top: 22px; /* Increased margin */ + margin-left: 2px; + margin-right: 2px; + width: 30px; /* Increased width */ text-align: center; } @@ -168,9 +183,9 @@ font-family: "Plus Jakarta Sans", sans-serif; font-style: normal; font-weight: 600; - width: 30px; /* Adjust the width to prevent overflow */ - font-size: 0.9rem; - margin-bottom: 10px; + width: 36px; /* Increased width */ + font-size: 1rem; /* Increased font size */ + margin-bottom: 12px; /* Increased margin */ text-align: center; background-color: transparent; } @@ -180,14 +195,14 @@ border: 1px solid var(--brand-sage, #6B8F71); color: #ffffff; display: inline-block; - font-size: 13px; + font-size: 14px; /* Increased font size */ font-weight: 600; cursor: pointer; - min-width: 84px; - height: 34px; - padding: 0 14px; - border-radius: 10px; /* square rounded corner */ - box-shadow: 0 1px 2px rgba(0,0,0,0.08); + min-width: 85px; /* Increased width */ + height: 36px; /* Increased height */ + padding: 0 14px; /* Increased padding */ + border-radius: 12px; /* Increased border radius */ + box-shadow: 0 1px 3px rgba(0,0,0,0.08); } .addButton:hover { background-color: var(--brand-sage-hover, #7FAE7D); border-color: var(--brand-sage-hover, #7FAE7D); } .addButton:disabled { background-color: var(--brand-sage-muted, #CFD8D3); border-color: var(--brand-sage-muted, #CFD8D3); cursor: default; } @@ -199,32 +214,32 @@ color: gray; } .plusNegative { - width: 30px; - height: 30px; + width: 36px; /* Increased width */ + height: 36px; /* Increased height */ } .plusNegative2 { - width: 84px; - height: 21px; + width: 90px; /* Increased width */ + height: 24px; /* Increased height */ position: absolute; transform: rotate(45deg); - left: -33px; - top: 21px; + left: -38px; /* Adjusted position */ + top: 24px; /* Adjusted position */ } .remove { - width: 25px; - height: 25px; - margin-top: -10px; - margin-right: 10px; + width: 30px; /* Increased width */ + height: 30px; /* Increased height */ + margin-top: -12px; /* Adjusted margin */ + margin-right: 12px; /* Adjusted margin */ } /* New elements for clean cafe item card */ .title { font-family: "Plus Jakarta Sans", sans-serif; font-weight: 600; - font-size: 16px; + font-size: 18px; /* Increased font size */ color: #2d2d2d; - margin: 0 0 2px 0; + margin: 0 0 3px 0; /* Increased margin */ display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; @@ -236,71 +251,184 @@ /* Responsive type scale for title and price */ @media (min-width: 600px) { - .title { font-size: 17px; } - .priceNow { font-size: 15px; } + .title { font-size: 19px; } + .priceNow { font-size: 17px; } } @media (min-width: 992px) { - .title { font-size: 18px; } - .priceNow { font-size: 16px; } + .title { font-size: 20px; } + .priceNow { font-size: 18px; } } .desc { color: #5f5f5f; - font-size: 12px; - line-height: 1.25; + font-size: 14px; /* Increased font size */ + line-height: 1.3; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; -webkit-line-clamp: 2; } -.priceRow { display: inline-flex; align-items: center; gap: 8px; } +.priceRow { display: inline-flex; align-items: center; gap: 10px; } /* Increased gap */ + +/* Gaya harga baru untuk item list */ +.itemPriceList { + font-family: "Plus Jakarta Sans", sans-serif; + font-weight: 700; + font-size: 14px; + color: #1c1d1d; + margin: 2px 0; + white-space: nowrap; +} + +.itemPriceList.promo { + color: #e53935; + font-size: 13px; +} + +.itemPriceList.original { + color: #727272; + font-size: 12px; + text-decoration: line-through; +} + .promoBadge { display: inline-flex; align-items: center; justify-content: center; - padding: 2px 8px; - height: 20px; + padding: 3px 10px; /* Increased padding */ + height: 24px; /* Increased height */ border-radius: 999px; background: linear-gradient(to right, #e52535, #fe6d78); color: #fff; - font-size: 11px; + font-size: 13px; /* Increased font size */ font-weight: 700; } .priceNow { color: #1c1d1d; font-weight: 700; - font-size: 14px; + font-size: 16px; /* Increased font size */ white-space: nowrap; } .priceOld { color: #727272; - font-size: 12px; + font-size: 14px; /* Increased font size */ text-decoration: line-through; white-space: nowrap; } .qtyGroup { display: inline-flex; align-items: center; - border: 1px solid #e6e6e6; - border-radius: 10px; /* square rounded corners */ - height: 32px; + border: 1px solid rgba(255,255,255,0.6); + border-radius: 10px; /* Increased border radius */ + height: 30px; /* Increased height */ overflow: hidden; + background: transparent; } .qtyBtn { - width: 34px; - height: 32px; + width: 30px; /* Increased width */ + height: 30px; /* Increased height */ display: flex; align-items: center; justify-content: center; - background: #fff; - color: var(--brand-sage, #6B8F71); + background: transparent; + color: #fff; border: none; + font-size: 20px; /* Increased font size */ } -.qtyBtn:hover { background: var(--brand-sage-50, #F0F6F2); } +.qtyBtn:hover { background: rgba(255,255,255,0.15); } .qtyVal { - min-width: 28px; + min-width: 26px; /* Increased width */ text-align: center; font-weight: 700; - color: #2d2d2d; + color: #fff; + font-size: 15px; /* Increased font size */ +} + +.actionRow { display: flex; align-items: center; gap: 8px; justify-content: space-between; width: 100%; } /* Increased gap */ + +/* Promo pill overlay on image */ +.promoPill { + position: absolute; + top: 14px; /* Increased top position */ + right: 14px; /* Increased right position */ + z-index: 2; + display: inline-flex; + align-items: center; + justify-content: center; + padding: 5px 12px; /* Increased padding */ + height: auto; + border-radius: 10px; /* Increased border radius */ + background: #e53935; + color: #fff; + font-size: 13px; /* Increased font size */ + font-weight: 700; +} + +/* Info overlay on image (name + price) */ +.overlayName { + position: absolute; + top: 14px; /* Increased top position */ + left: 14px; /* Increased left position */ + z-index: 2; + font-family: "Plus Jakarta Sans", sans-serif; + font-weight: 800; + font-size: 16px; /* Increased font size */ + line-height: 1.3; + color: #fff; + mix-blend-mode: difference; + margin: 0; + max-width: 75%; /* Increased width */ + display: -webkit-box; + -webkit-box-orient: vertical; + overflow: hidden; + -webkit-line-clamp: 2; + pointer-events: none; + text-transform: capitalize; +} +@media (min-width: 600px) { .overlayName { font-size: 17px; } } +.overlayPrice { display: flex; align-items: center; gap: 8px; } /* Increased gap */ +.overlayNow { color: #fff; font-weight: 800; font-size: 14px; } /* Increased font size */ +.overlayOld { color: rgba(255,255,255,0.8); font-size: 13px; text-decoration: line-through; } /* Increased font size */ + +/* Bottom overlay bar: price left, qty right */ +.bottomOverlay { + position: absolute; + left: 0; + right: 0; + bottom: 0; + z-index: 2; + display: flex; + align-items: center; + justify-content: space-between; + padding: 6px 12px; /* Increased padding */ + background: rgba(0,0,0,0.55); + color: #fff; +} + +/* New stacked price for clarity */ +.overlayPriceCol { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; } /* Increased line height */ +.overlayOriginal { color: rgba(255,255,255,0.85); font-weight: 700; font-size: 12px; text-decoration: line-through; } /* Increased font size */ +@media (min-width: 600px) { .overlayOriginal { font-size: 13px; } } +.overlayPromo { color: #fff; font-weight: 900; font-size: 18px; } /* Increased font size */ +@media (min-width: 600px) { + .overlayOriginal { font-size: 16px; } /* Increased font size */ + .overlayPromo { font-size: 20px; } /* Increased font size */ +} + +/* Title text below image for portrait mode */ +.title { + font-family: "Plus Jakarta Sans", sans-serif; + font-weight: 700; + font-size: 16px; /* Increased font size */ + color: #1c1d1d; + margin: 8px 3px 6px 3px; /* Increased margin */ + text-transform: capitalize; + display: -webkit-box; + -webkit-box-orient: vertical; + overflow: hidden; + -webkit-line-clamp: 2; +} +@media (min-width: 600px) { + .title { font-size: 17px; } /* Increased font size */ } .itemInvoice .itemDetails { @@ -312,7 +440,7 @@ .itemInvoice .itemName, .itemInvoice .itemPrice, .itemInvoice .itemQty .qtyInvoice .multiplySymbol { - font-size: 0.9rem; + font-size: 1.1rem; /* Increased font size */ } .blank { @@ -325,6 +453,6 @@ .createItem { position: absolute; - left: 15px; - right: 15px; -} + left: 18px; /* Increased position */ + right: 18px; /* Increased position */ +} \ No newline at end of file diff --git a/src/components/ItemConfig.js b/src/components/ItemConfig.js index a3498f4..6c62bf6 100644 --- a/src/components/ItemConfig.js +++ b/src/components/ItemConfig.js @@ -93,10 +93,10 @@ const ItemConfig = ({ return (
-
+
{/* Increased padding and border radius */}
-
- +
{/* Increased size and margin */} + {/* Increased border radius */}
-
-
handleChangeImage()} style={{ width: '140px', marginRight: '10px', height: '40px', alignContent: 'center', textAlign: 'center', borderRadius: '10px', border: '1px solid #60d37e', color: '#60d37e', backgroundColor: 'white', display: 'flex', justifyContent: 'center', alignItems: 'center' }}> +
{/* Increased size */} +
handleChangeImage()} style={{ width: '160px', marginRight: '12px', height: '48px', alignContent: 'center', textAlign: 'center', borderRadius: '12px', border: '1px solid #60d37e', color: '#60d37e', backgroundColor: 'white', display: 'flex', justifyContent: 'center', alignItems: 'center', fontSize: '16px' }}> {/* Increased size and font */} {isBeingEdit ? 'Ganti gambar' : 'Tambah gambar'}
-
+
{/* Increased size and font */} Hapus
-
-

Nama item

+
{/* Increased margin */} +

Nama item

{/* Increased margin and font size */} setItemName(e.target.value)} onFocus={(e) => e.target.style.borderColor = '#60d37e'} @@ -139,16 +139,16 @@ const ItemConfig = ({
-

Harga

+

Harga

{/* Increased margin and font size */}
-

Harga promo

+

Harga promo

{/* Increased margin and font size */}
-

Deskripsi

+

Deskripsi

{/* Increased margin and font size */}