Skip to content

Commit bc66ad4

Browse files
committed
responsive design improvements
1 parent b22ca28 commit bc66ad4

File tree

1 file changed

+27
-22
lines changed

1 file changed

+27
-22
lines changed

Diff for: app/home/page.js

+27-22
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,21 @@ function Home() {
4040
if (!product) {
4141
throw new Error("Produto não encontrado");
4242
}
43-
const response = await fetch("https://bazzar-39eb.onrender.com/api/cart", {
44-
method: "POST",
45-
headers: {
46-
Authorization: `Bearer ${token}`,
47-
"Content-Type": "application/json",
48-
},
49-
body: JSON.stringify({
50-
user_id: 1,
51-
product_id: product.id,
52-
quantity: 1,
53-
}),
54-
});
43+
const response = await fetch(
44+
"https://bazzar-39eb.onrender.com/api/cart",
45+
{
46+
method: "POST",
47+
headers: {
48+
Authorization: `Bearer ${token}`,
49+
"Content-Type": "application/json",
50+
},
51+
body: JSON.stringify({
52+
user_id: 1,
53+
product_id: product.id,
54+
quantity: 1,
55+
}),
56+
}
57+
);
5558

5659
if (!response.ok) {
5760
throw new Error("Erro ao adicionar ao carrinho");
@@ -364,10 +367,10 @@ function Home() {
364367

365368
<div className="flex relative w-full h-96 overflow-hidden bg-[#FF3300] shadow-lg rounded-[35px]">
366369
<div className="absolute p-6 z-20">
367-
<h1 className="text-white font-bold text-5xl w-40 leading-[70px] italic">
370+
<h1 className="text-white font-bold text-3xl lg:text-5xl w-40 leading-[70px] italic p-4">
368371
Decorative Pillowcases Velvet
369372
</h1>
370-
<h2 className="text-white font-bold text-3xl italic">
373+
<h2 className="text-white font-bold text-xl lg:text-3xl italic p-4">
371374
Bring charm and modernity to <br></br> your interior
372375
</h2>
373376
</div>
@@ -416,7 +419,9 @@ function Home() {
416419
))
417420
) : (
418421
<div className="w-full flex gap-2 items-center justify-center pt-5 h-80">
419-
<h1 className="font-bold">None of the products match the search</h1>
422+
<h1 className="font-bold">
423+
No products found
424+
</h1>
420425
<h1 className="font-bold text-[#FF3300] text-xl">:&#40;</h1>
421426
</div>
422427
)}
@@ -425,13 +430,13 @@ function Home() {
425430
<div
426431
className={
427432
showCart
428-
? "absolute p-2 top-28 rounded-lg right-14 bg-white w-[500px] h-[400px] shadow-lg z-50 flex flex-col gap-4 overflow-auto"
433+
? "absolute p-2 top-28 rounded-lg right-12 lg:right-14 bg-white w-[300px] lg:w-[500px] h-[400px] shadow-lg z-50 flex flex-col gap-4 overflow-auto"
429434
: "hidden"
430435
}
431436
>
432437
{cartItems.length === 0 && (
433438
<div className="flex flex-col items-center justify-center gap-10 w-full h-full">
434-
<h1 className="font-bold text-3xl">The cart is empty 😪</h1>
439+
<h1 className="font-bold text-2xl lg:text-3xl">The cart is empty 😪</h1>
435440
<svg
436441
className="w-40 h-40"
437442
viewBox="0 0 24 24"
@@ -453,7 +458,7 @@ function Home() {
453458
return (
454459
<div
455460
key={item.id}
456-
className="flex items-center justify-between p-2 gap-2 w-full h-14 border border-[#999999] rounded-[18px]"
461+
className="flex flex-wrap items-center justify-between p-2 gap-2 w-full border border-[#999999] rounded-[18px]"
457462
>
458463
<div className="flex gap-1 items-center">
459464
<div className="flex items-center justify-center w-8 h-8">
@@ -465,12 +470,12 @@ function Home() {
465470
/>
466471
</div>
467472
<h2 className="font-bold truncate w-40">{item.name}</h2>
468-
<h2 className="font-bold truncate max-w-40 text-[#FF3300]">
469-
US$ {item.price}
470-
</h2>
471473
</div>
472474

473475
<div className="flex gap-4 items-center justify-center">
476+
<h2 className="font-bold truncate max-w-40 text-[#FF3300]">
477+
US$ {item.price}
478+
</h2>
474479
{/* Botão de Deletar item do carrinho */}
475480
<button
476481
onClick={() => removeFromCart(item.product_id)}
@@ -542,7 +547,7 @@ function Home() {
542547
</svg>
543548
</button>
544549
</div>
545-
<h2 className="font-bold text-xl">x{item.quantity}</h2>
550+
<h2 className="font-bold text-xl w-10">x{item.quantity}</h2>
546551
</div>
547552
);
548553
})}

0 commit comments

Comments
 (0)