Skip to content

Commit 0781417

Browse files
committed
refactor(produto): remove unnecessary comments.
1 parent 99a20ae commit 0781417

4 files changed

Lines changed: 76 additions & 82 deletions

File tree

web/src/app/HomePage/page.tsx

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,12 @@ export default function Home() {
1515
<div className="p-4">
1616
{loading ? (
1717
<div>
18-
{/* Busca */}
1918
<div className="w-full h-11 bg-gray-200 rounded-xl mb-4 animate-pulse"></div>
2019

21-
{/* Título */}
2220
<div className="h-6 w-28 bg-gray-200 rounded mb-2 animate-pulse"></div>
2321

24-
{/* Quantidade */}
2522
<div className="h-4 w-16 bg-gray-200 rounded mb-4 animate-pulse"></div>
2623

27-
{/* Cards */}
2824
<div className="grid grid-cols-2 lg:grid-cols-4 gap-3">
2925
{Array.from({ length: 4 }).map((_, index) => (
3026
<ProductCardSkeleton key={index} />
@@ -35,7 +31,6 @@ export default function Home() {
3531
<>
3632
{!error && (
3733
<>
38-
{/* Busca */}
3934
<input
4035
type="text"
4136
placeholder="Buscar produtos..."
@@ -44,17 +39,14 @@ export default function Home() {
4439
onChange={(e) => setSearch(e.target.value)}
4540
/>
4641

47-
{/* Título */}
4842
<h2 className="text-lg font-semibold">Produtos</h2>
4943

50-
{/* Quantidade */}
5144
<p className="text-sm text-gray-500 mb-3">
5245
{filtered.length} itens
5346
</p>
5447
</>
5548
)}
5649

57-
{/* ERRO */}
5850
{error ? (
5951
<div className="space-y-4">
6052
<h2 className="text-lg font-semibold">Produtos</h2>
@@ -67,10 +59,8 @@ export default function Home() {
6759
</div>
6860
) : (
6961
<>
70-
{/* Nenhum produto */}
7162
{filtered.length === 0 && <p>Nenhum produto encontrado.</p>}
7263

73-
{/* LISTA */}
7464
{filtered.length > 0 && (
7565
<div className="grid grid-cols-2 lg:grid-cols-4 gap-3">
7666
{filtered.map((product) => (
@@ -84,4 +74,4 @@ export default function Home() {
8474
)}
8575
</div>
8676
);
87-
}
77+
}
Lines changed: 43 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { useState } from "react";
22

33
export default function Navbar() {
4-
// Controla se o menu mobile está aberto ou fechado
54
const [isOpen, setIsOpen] = useState(false);
65

76
return (
@@ -11,43 +10,66 @@ export default function Navbar() {
1110
<div className="w-2 h-2 bg-primary rounded-full"></div>
1211
<span>OrderFlow</span>
1312
</div>
14-
15-
{/* Botão hambúrguer (lado direito, só aparece no mobile) */}
1613
<button
1714
onClick={() => setIsOpen(!isOpen)}
1815
className="md:hidden p-2 rounded-md hover:bg-gray-100"
1916
aria-label="Abrir menu"
2017
>
21-
{/* Troca o ícone dependendo do estado */}
2218
{isOpen ? (
23-
// Ícone X (fechar)
24-
<svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
25-
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />
19+
<svg
20+
className="w-5 h-5"
21+
fill="none"
22+
stroke="currentColor"
23+
viewBox="0 0 24 24"
24+
>
25+
<path
26+
strokeLinecap="round"
27+
strokeLinejoin="round"
28+
strokeWidth={2}
29+
d="M6 18L18 6M6 6l12 12"
30+
/>
2631
</svg>
2732
) : (
28-
// Ícone hambúrguer (3 linhas)
29-
<svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
30-
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M4 6h16M4 12h16M4 18h16" />
33+
<svg
34+
className="w-5 h-5"
35+
fill="none"
36+
stroke="currentColor"
37+
viewBox="0 0 24 24"
38+
>
39+
<path
40+
strokeLinecap="round"
41+
strokeLinejoin="round"
42+
strokeWidth={2}
43+
d="M4 6h16M4 12h16M4 18h16"
44+
/>
3145
</svg>
3246
)}
3347
</button>
34-
35-
{/* Links no desktop (some no mobile) */}
3648
<div className="hidden md:flex items-center gap-4">
37-
<a href="#" className="hover:text-primary">Início</a>
38-
<a href="#" className="hover:text-primary">Pedidos</a>
39-
<a href="#" className="hover:text-primary">Configurações</a>
49+
<a href="#" className="hover:text-primary">
50+
Início
51+
</a>
52+
<a href="#" className="hover:text-primary">
53+
Pedidos
54+
</a>
55+
<a href="#" className="hover:text-primary">
56+
Configurações
57+
</a>
4058
</div>
4159
</div>
42-
43-
{/* Menu mobile — só aparece quando isOpen for true */}
4460
{isOpen && (
4561
<div className="md:hidden flex flex-col px-4 pb-4 gap-3 border-t border-border">
46-
<a href="/" className="hover:text-primary">Produtos</a>
47-
<a href="/checkout" className="hover:text-primary">Checkout</a>
48-
<a href="/email-confirm" className="hover:text-primary">Pedido</a>
62+
<a href="/" className="hover:text-primary">
63+
Produtos
64+
</a>
65+
<a href="/checkout" className="hover:text-primary">
66+
Checkout
67+
</a>
68+
<a href="/email-confirm" className="hover:text-primary">
69+
Pedido
70+
</a>
4971
</div>
5072
)}
5173
</nav>
5274
);
53-
}
75+
}
Lines changed: 31 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,37 @@
1-
type Category = {
1+
type Category = {
22
id: number;
33
name: string;
44
};
5-
6-
type Product = {
7-
id: number;
8-
name: string;
9-
category?: Category;
10-
price: number;
11-
};
125

13-
type Props = {
14-
product: Product;
15-
};
16-
17-
export default function ProductCard({ product }: Props) {
18-
return (
19-
<div className="bg-surface rounded-lg p-3 shadow-sm border border-border">
20-
{/* Imagem */}
21-
<img
22-
src={`/products/${product.id}.webp`}
23-
alt={product.name}
24-
className="h-20 w-full object-contain rounded mb-2"
25-
/>
26-
27-
{/* Categoria */}
28-
{product.category && (
29-
<span className="text-xs bg-blue-100 text-blue-600 px-2 py-1 rounded">
30-
{product.category.name}
31-
</span>
32-
)}
33-
34-
{/* Nome */}
35-
<h3 className="text-sm mt-2">{product.name}</h3>
6+
type Product = {
7+
id: number;
8+
name: string;
9+
category?: Category;
10+
price: number;
11+
};
3612

37-
{/* Preço */}
38-
<p className="text-sm font-semibold">R$ {product.price.toFixed(2)}</p>
13+
type Props = {
14+
product: Product;
15+
};
3916

40-
{/* Botão */}
41-
<button className="w-full mt-2 bg-black text-white text-sm py-1 rounded">
42-
Adicionar
43-
</button>
44-
</div>
45-
);
46-
}
17+
export default function ProductCard({ product }: Props) {
18+
return (
19+
<div className="bg-surface rounded-lg p-3 shadow-sm border border-border">
20+
<img
21+
src={`/products/${product.id}.webp`}
22+
alt={product.name}
23+
className="h-20 w-full object-contain rounded mb-2"
24+
/>
25+
{product.category && (
26+
<span className="text-xs bg-blue-100 text-blue-600 px-2 py-1 rounded">
27+
{product.category.name}
28+
</span>
29+
)}
30+
<h3 className="text-sm mt-2">{product.name}</h3>
31+
<p className="text-sm font-semibold">R$ {product.price.toFixed(2)}</p>
32+
<button className="w-full mt-2 bg-black text-white text-sm py-1 rounded">
33+
Adicionar
34+
</button>
35+
</div>
36+
);
37+
}
Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
11
export default function ProductCardSkeleton() {
22
return (
33
<div className="bg-surface rounded-lg p-3 shadow-sm border border-border animate-pulse">
4-
{/* Imagem */}
54
<div className="h-20 bg-gray-200 rounded mb-3"></div>
6-
7-
{/* Categoria */}
85
<div className="h-4 w-16 bg-gray-200 rounded mb-2"></div>
9-
10-
{/* Nome */}
116
<div className="h-4 w-28 bg-gray-200 rounded mb-2"></div>
12-
13-
{/* Preço */}
147
<div className="h-4 w-20 bg-gray-200 rounded mb-3"></div>
15-
16-
{/* Botão */}
178
<div className="h-8 w-full bg-gray-300 rounded"></div>
189
</div>
1910
);
20-
}
11+
}

0 commit comments

Comments
 (0)