|
1 | | -import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; |
2 | | -import { useLocation, useNavigate } from "react-router-dom"; |
3 | | -import { useEffect } from "react"; |
| 1 | +import { NavLink, Outlet } from "react-router-dom"; |
4 | 2 | import Header from "@/components/Header"; |
5 | 3 | import Footer from "@/components/Footer"; |
6 | | -import DocsIntroducao from "./docs/DocsIntroducao"; |
7 | | -import DocsGuias from "./docs/DocsGuias"; |
8 | | -import DocsDicasTruques from "./docs/DocsDicasTruques"; |
9 | | -import DocsEcossistema from "./docs/DocsEcossistema"; |
10 | | -import DocsSobre from "./docs/DocsSobre"; |
11 | 4 |
|
12 | 5 | const Docs = () => { |
13 | | - const location = useLocation(); |
14 | | - const navigate = useNavigate(); |
15 | | - |
16 | | - // Extrair a aba ativa da URL |
17 | | - const currentTab = location.pathname.split('/docs/')[1] || 'introducao'; |
18 | | - |
19 | | - const handleTabChange = (value: string) => { |
20 | | - navigate(`/docs/${value}`); |
21 | | - }; |
22 | | - |
23 | | - // Redirecionar para /docs/introducao se estiver apenas em /docs |
24 | | - useEffect(() => { |
25 | | - if (location.pathname === '/docs') { |
26 | | - navigate('/docs/introducao', { replace: true }); |
27 | | - } |
28 | | - }, [location.pathname, navigate]); |
| 6 | + const navigationItems = [ |
| 7 | + { label: "Introdução", path: "/docs/introducao" }, |
| 8 | + { label: "Guias", path: "/docs/guias" }, |
| 9 | + { label: "Dicas & Truques", path: "/docs/dicas-truques" }, |
| 10 | + { label: "Ecossistema", path: "/docs/ecossistema" }, |
| 11 | + { label: "Sobre", path: "/docs/sobre" }, |
| 12 | + ]; |
29 | 13 |
|
30 | 14 | return ( |
31 | 15 | <div className="min-h-screen flex flex-col" style={{ background: 'var(--gradient-background)' }}> |
32 | 16 | <Header /> |
33 | 17 | <div className="flex-1 flex flex-col"> |
34 | | - <div className="container mx-auto px-4 py-8"> |
35 | | - <Tabs value={currentTab} onValueChange={handleTabChange} className="w-full"> |
36 | | - <TabsList className="grid w-full grid-cols-5 mb-8"> |
37 | | - <TabsTrigger value="introducao">Introdução</TabsTrigger> |
38 | | - <TabsTrigger value="guias">Guias</TabsTrigger> |
39 | | - <TabsTrigger value="dicas-truques">Dicas & Truques</TabsTrigger> |
40 | | - <TabsTrigger value="ecossistema">Ecossistema</TabsTrigger> |
41 | | - <TabsTrigger value="sobre">Sobre</TabsTrigger> |
42 | | - </TabsList> |
43 | | - |
44 | | - <TabsContent value="introducao" className="mt-0"> |
45 | | - <DocsIntroducao /> |
46 | | - </TabsContent> |
47 | | - |
48 | | - <TabsContent value="guias" className="mt-0"> |
49 | | - <DocsGuias /> |
50 | | - </TabsContent> |
51 | | - |
52 | | - <TabsContent value="dicas-truques" className="mt-0"> |
53 | | - <DocsDicasTruques /> |
54 | | - </TabsContent> |
55 | | - |
56 | | - <TabsContent value="ecossistema" className="mt-0"> |
57 | | - <DocsEcossistema /> |
58 | | - </TabsContent> |
59 | | - |
60 | | - <TabsContent value="sobre" className="mt-0"> |
61 | | - <DocsSobre /> |
62 | | - </TabsContent> |
63 | | - </Tabs> |
| 18 | + <div className="border-b border-border bg-background/50 backdrop-blur-sm sticky top-0 z-10"> |
| 19 | + <div className="container mx-auto px-4"> |
| 20 | + <nav className="flex space-x-8"> |
| 21 | + {navigationItems.map((item) => ( |
| 22 | + <NavLink |
| 23 | + key={item.path} |
| 24 | + to={item.path} |
| 25 | + className={({ isActive }) => |
| 26 | + `py-4 px-2 text-sm font-medium transition-colors hover:text-primary border-b-2 ${ |
| 27 | + isActive |
| 28 | + ? "text-primary border-primary" |
| 29 | + : "text-muted-foreground border-transparent hover:border-primary/50" |
| 30 | + }` |
| 31 | + } |
| 32 | + > |
| 33 | + {item.label} |
| 34 | + </NavLink> |
| 35 | + ))} |
| 36 | + </nav> |
| 37 | + </div> |
| 38 | + </div> |
| 39 | + |
| 40 | + <div className="flex-1 container mx-auto px-4 py-8"> |
| 41 | + <Outlet /> |
64 | 42 | </div> |
65 | 43 | </div> |
66 | 44 | <Footer /> |
|
0 commit comments