11"use client" ;
22
3+ import {
4+ MinusIcon ,
5+ PlusIcon ,
6+ ShoppingCartIcon ,
7+ XMarkIcon ,
8+ } from "@heroicons/react/16/solid" ;
39import { useEffect , useRef , useState } from "react" ;
10+ import clsx from "clsx" ;
411
512function Price ( { amount, currencyCode, className } ) {
613 return (
@@ -11,24 +18,56 @@ function Price({ amount, currencyCode, className }) {
1118}
1219
1320function CloseCart ( ) {
14- return < span > X</ span > ;
21+ return (
22+ < div className = "relative flex h-11 w-11 items-center justify-center rounded-md border border-neutral-200 text-black transition-colors dark:border-neutral-700 dark:text-white" >
23+ < XMarkIcon
24+ className = { clsx ( "h-6 transition-all ease-in-out hover:scale-110 " ) }
25+ />
26+ </ div >
27+ ) ;
1528}
1629
1730function OpenCart ( { quantity } ) {
1831 return (
19- < div >
20- < span > Cart</ span >
21- { quantity > 0 && < span > ({ quantity } )</ span > }
32+ < div className = "relative flex h-11 w-11 items-center justify-center rounded-md border transition-colors border-neutral-700 text-white" >
33+ < ShoppingCartIcon className = "h-4 transition-all ease-in-out hover:scale-110" />
34+ < div className = "flex items-center justify-center flex-none font-bold absolute top-0 bg-indigo-500 text-black w-5 h-5 rounded-full -mt-2 right-0 -mr-2 text-xs text-white" >
35+ { quantity > 0 && < span > { quantity } </ span > }
36+ </ div >
2237 </ div >
2338 ) ;
2439}
2540
2641function DeleteItemButton ( { item } ) {
27- return < button > Delete</ button > ;
42+ return (
43+ < button
44+ type = "submit"
45+ aria-label = "Remove cart item"
46+ className = "ease flex h-[17px] w-[17px] items-center justify-center rounded-full bg-neutral-500 transition-all duration-200"
47+ >
48+ < XMarkIcon className = "hover:text-accent-3 mx-[1px] h-4 w-4 text-white" />
49+ </ button >
50+ ) ;
2851}
2952
3053function EditItemQuantityButton ( { item, type } ) {
31- return < button > { type === "minus" ? "-" : "+" } </ button > ;
54+ return (
55+ < button
56+ type = "submit"
57+ className = { clsx (
58+ "ease flex h-full min-w-[36px] max-w-[36px] flex-none items-center justify-center rounded-full px-2 transition-all duration-200 hover:border-neutral-800 hover:opacity-80" ,
59+ {
60+ "ml-auto" : type === "minus" ,
61+ }
62+ ) }
63+ >
64+ { type === "plus" ? (
65+ < PlusIcon className = "h-4 w-4 dark:text-neutral-500" />
66+ ) : (
67+ < MinusIcon className = "h-4 w-4 dark:text-neutral-500" />
68+ ) }
69+ </ button >
70+ ) ;
3271}
3372
3473export default function CartModal ( ) {
@@ -101,7 +140,7 @@ export default function CartModal() {
101140 { isOpen && (
102141 < div className = "relative z-50" >
103142 < div className = "fixed inset-0 bg-black/30" aria-hidden = "true" />
104- < div className = "fixed bottom-0 right-0 top-0 flex h-full w-full flex-col border-l border-neutral-200 bg-white p-6 text-black md:w-[390px]" >
143+ < div className = "fixed bottom-0 right-0 top-0 flex h-full w-full flex-col border-l border-neutral-700 bg-black p-6 text-white md:w-[390px]" >
105144 < div className = "flex items-center justify-between" >
106145 < p className = "text-lg font-semibold" > My Cart</ p >
107146 < button aria-label = "Close cart" onClick = { closeCart } >
@@ -121,7 +160,7 @@ export default function CartModal() {
121160 { cart . lines . map ( ( item , i ) => (
122161 < li
123162 key = { i }
124- className = "flex w-full flex-col border-b border-neutral-300 "
163+ className = "flex w-full flex-col border-b border-neutral-700 "
125164 >
126165 < div className = "relative flex w-full flex-row justify-between px-1 py-4" >
127166 < div className = "absolute z-40 -mt-2 ml-[55px]" >
@@ -132,7 +171,7 @@ export default function CartModal() {
132171 onClick = { closeCart }
133172 className = "z-30 flex flex-row space-x-4"
134173 >
135- < div className = "relative h-16 w-16 cursor-pointer overflow-hidden rounded-md border border-neutral-300 bg-neutral-300 " >
174+ < div className = "relative h-16 w-16 cursor-pointer overflow-hidden rounded-md border border-neutral-700 bg-neutral-700 " >
136175 < img
137176 className = "h-full w-full object-cover"
138177 width = { 64 }
@@ -149,7 +188,7 @@ export default function CartModal() {
149188 { item . merchandise . product . title }
150189 </ span >
151190 { item . merchandise . title !== "Default Option" && (
152- < p className = "text-sm text-neutral-500 " >
191+ < p className = "text-sm text-neutral-300 " >
153192 { item . merchandise . title }
154193 </ p >
155194 ) }
@@ -161,7 +200,7 @@ export default function CartModal() {
161200 amount = { item . cost . totalAmount . amount }
162201 currencyCode = { item . cost . totalAmount . currencyCode }
163202 />
164- < div className = "ml-auto flex h-9 flex-row items-center rounded-full border border-neutral-200 " >
203+ < div className = "ml-auto flex h-9 flex-row items-center rounded-full border border-neutral-700 " >
165204 < EditItemQuantityButton item = { item } type = "minus" />
166205 < p className = "w-6 text-center" >
167206 < span className = "w-full text-sm" >
@@ -175,31 +214,31 @@ export default function CartModal() {
175214 </ li >
176215 ) ) }
177216 </ ul >
178- < div className = "py-4 text-sm text-neutral-500 " >
179- < div className = "mb-3 flex items-center justify-between border-b border-neutral-200 pb-1" >
217+ < div className = "py-4 text-sm text-neutral-300 " >
218+ < div className = "mb-3 flex items-center justify-between border-b border-neutral-700 pb-1" >
180219 < p > Taxes</ p >
181220 < Price
182- className = "text-right text-base text-black "
221+ className = "text-right text-base text-white "
183222 amount = { cart . cost . totalTaxAmount . amount }
184223 currencyCode = { cart . cost . totalTaxAmount . currencyCode }
185224 />
186225 </ div >
187- < div className = "mb-3 flex items-center justify-between border-b border-neutral-200 pb-1 pt-1" >
226+ < div className = "mb-3 flex items-center justify-between border-b border-neutral-700 pb-1 pt-1" >
188227 < p > Shipping</ p >
189228 < p className = "text-right" > Calculated at checkout</ p >
190229 </ div >
191- < div className = "mb-3 flex items-center justify-between border-b border-neutral-200 pb-1 pt-1" >
230+ < div className = "mb-3 flex items-center justify-between border-b border-neutral-700 pb-1 pt-1" >
192231 < p > Total</ p >
193232 < Price
194- className = "text-right text-base text-black "
233+ className = "text-right text-base text-white "
195234 amount = { cart . cost . totalAmount . amount }
196235 currencyCode = { cart . cost . totalAmount . currencyCode }
197236 />
198237 </ div >
199238 </ div >
200239 < a
201240 href = { cart . checkoutUrl }
202- className = "block w-full rounded-full bg-blue-600 p-3 text-center text-sm font-medium text-white opacity-90 hover:opacity-100"
241+ className = "block w-full rounded-full bg-indigo-500 p-3 text-center text-sm font-medium text-white opacity-90 hover:opacity-100"
203242 >
204243 Proceed to Checkout
205244 </ a >
0 commit comments