1- import { Card , CardContent , CardDescription , CardHeader , CardTitle } from "@/components/ui/card" ;
2- import { Clock , Code } from "lucide-react" ;
3- import { DocsResponsiveSidebar , SidebarItem } from "@/components/DocsResponsiveSidebar" ;
1+ import { ResponsiveLayout , ResponsiveLayoutRef } from "@/components/docs/ResponsiveLayout.tsx" ;
2+ import {
3+ ResponsiveLayoutSidebar ,
4+ ResponsiveLayoutSidebarItem ,
5+ } from "@/components/docs/ResponsiveLayoutSidebar.tsx" ;
6+ import React , { useRef } from "react" ;
7+ import { Outlet , useNavigate } from "react-router-dom" ;
48
59const Examples = ( ) => {
6- const sidebarItems : SidebarItem [ ] = [
10+ const layoutRef = useRef < ResponsiveLayoutRef > ( null ) ;
11+ const navigate = useNavigate ( ) ;
12+ const sidebarItems : ResponsiveLayoutSidebarItem [ ] = [
713 { id : "constructo" , label : "Constructo" } ,
814 { id : "validacao-forms" , label : "Validação de Forms" , level : 1 } ,
915 { id : "gerenciamento-estado" , label : "Gerenciamento de Estado" , level : 1 } ,
@@ -15,54 +21,17 @@ const Examples = () => {
1521 { id : "testes-automatizados" , label : "Testes Automatizados" , level : 1 } ,
1622 ] ;
1723
18- const handleItemClick = ( id : string ) => {
19- const element = document . getElementById ( id ) ;
20- element ?. scrollIntoView ( { behavior : "smooth" } ) ;
24+ const handleItemClick = ( item : ResponsiveLayoutSidebarItem ) => {
25+ navigate ( `/docs/example/${ item . id } ` ) ;
2126 } ;
2227
2328 return (
24- < div className = "flex gap-8" >
25- < DocsResponsiveSidebar
26- items = { sidebarItems }
27- onItemClick = { handleItemClick }
28- title = "Exemplos"
29- description = "Navegue pelos exemplos práticos"
30- />
31-
32- { /* Conteúdo Principal - Coluna Direita */ }
33- < div className = "flex-1 space-y-8 lg:border-l lg:pl-8 pt-[16px]" >
34- < div className = "space-y-4" >
35- < h1 className = "text-4xl font-bold bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent" >
36- Exemplos Práticos
37- </ h1 >
38- < p className = "text-xl text-muted-foreground" >
39- Exemplos práticos e casos de uso dos pacotes Devitools.
40- </ p >
41- </ div >
42-
43- < Card className = "text-center py-12" >
44- < CardHeader className = "pb-4" >
45- < div className = "flex justify-center mb-4" >
46- < div className = "relative" >
47- < Code className = "h-12 w-12 text-muted-foreground" />
48- < Clock className = "h-6 w-6 text-amber-500 absolute -top-1 -right-1" />
49- </ div >
50- </ div >
51- < CardTitle className = "text-2xl" > Exemplos em Desenvolvimento</ CardTitle >
52- < CardDescription className = "text-base" >
53- Estamos preparando exemplos práticos e detalhados para cada pacote
54- </ CardDescription >
55- </ CardHeader >
56- < CardContent >
57- < p className = "text-muted-foreground" >
58- Em breve você encontrará aqui exemplos completos de uso dos pacotes Devitools,
59- incluindo casos de uso comuns, implementações de referência e código de exemplo pronto
60- para usar.
61- </ p >
62- </ CardContent >
63- </ Card >
64- </ div >
65- </ div >
29+ < ResponsiveLayout
30+ ref = { layoutRef }
31+ title = { "Aprendendo com Exemplos" }
32+ leftContent = { < ResponsiveLayoutSidebar items = { sidebarItems } onItemClick = { handleItemClick } /> }
33+ rightContent = { < Outlet /> }
34+ />
6635 ) ;
6736} ;
6837
0 commit comments