Skip to content

Commit 5a15f3c

Browse files
Refatorar navegação responsiva
Remover o hook `useIsMobile` e utilizar classes de responsividade do Tailwind CSS para controlar a visibilidade dos links de navegação e do menu dropdown no Header.
1 parent c82b56b commit 5a15f3c

File tree

1 file changed

+23
-27
lines changed

1 file changed

+23
-27
lines changed

src/pages/Docs.tsx

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@ import {
77
DropdownMenuTrigger,
88
} from "@/components/ui/dropdown-menu";
99
import { Button } from "@/components/ui/button";
10-
import { useIsMobile } from "@/hooks/use-mobile";
1110
import { Menu } from "lucide-react";
1211
import { NavLink, Outlet, useLocation } from "react-router-dom";
1312

1413
const Docs = () => {
1514
const location = useLocation();
16-
const isMobile = useIsMobile();
1715

1816
const navigationItems = [
1917
{ label: "Introdução", path: "/docs/introduction" },
@@ -41,7 +39,7 @@ const Docs = () => {
4139
<div className="container mx-auto px-4">
4240
<div className="flex items-center justify-between">
4341
{/* Desktop navigation - hidden on mobile */}
44-
<nav className={`flex space-x-8 ${isMobile ? 'hidden' : ''}`}>
42+
<nav className="hidden lg:flex space-x-8">
4543
{navigationItems.map(item => (
4644
<NavLink
4745
key={item.path}
@@ -60,30 +58,28 @@ const Docs = () => {
6058
</nav>
6159

6260
{/* Mobile dropdown menu */}
63-
{isMobile && (
64-
<div className="py-2">
65-
<DropdownMenu>
66-
<DropdownMenuTrigger asChild>
67-
<Button variant="ghost" size="sm" className="flex items-center space-x-2">
68-
<Menu className="w-4 h-4" />
69-
<span className="text-sm">Documentação</span>
70-
</Button>
71-
</DropdownMenuTrigger>
72-
<DropdownMenuContent align="start" className="w-48 bg-background">
73-
{navigationItems.map(item => (
74-
<DropdownMenuItem key={item.path} asChild>
75-
<NavLink
76-
to={item.path}
77-
className="w-full cursor-pointer"
78-
>
79-
{item.label}
80-
</NavLink>
81-
</DropdownMenuItem>
82-
))}
83-
</DropdownMenuContent>
84-
</DropdownMenu>
85-
</div>
86-
)}
61+
<div className="lg:hidden py-2">
62+
<DropdownMenu>
63+
<DropdownMenuTrigger asChild>
64+
<Button variant="ghost" size="sm" className="flex items-center space-x-2">
65+
<Menu className="w-4 h-4" />
66+
<span className="text-sm">Documentação</span>
67+
</Button>
68+
</DropdownMenuTrigger>
69+
<DropdownMenuContent align="start" className="w-48 bg-background">
70+
{navigationItems.map(item => (
71+
<DropdownMenuItem key={item.path} asChild>
72+
<NavLink
73+
to={item.path}
74+
className="w-full cursor-pointer"
75+
>
76+
{item.label}
77+
</NavLink>
78+
</DropdownMenuItem>
79+
))}
80+
</DropdownMenuContent>
81+
</DropdownMenu>
82+
</div>
8783
</div>
8884
</div>
8985
</div>

0 commit comments

Comments
 (0)