1- import { type SidebarItem } from "@/components/DocsResponsiveSidebar" ;
2- import ResponsiveLayout from "@/components/ResponsiveLayout.tsx" ;
1+ import ResponsiveLayout , { ResponsiveLayoutRef } from "@/components/ResponsiveLayout.tsx" ;
2+ import ResponsiveLayoutSidebar , {
3+ ResponsiveLayoutSidebarItem ,
4+ } from "@/components/ResponsiveLayoutSidebar.tsx" ;
35import { Badge } from "@/components/ui/badge" ;
46import { Card , CardContent , CardDescription , CardHeader , CardTitle } from "@/components/ui/card" ;
5- import { cn } from "@/lib/utils.ts" ;
67import { Layers , Package , Wrench } from "lucide-react" ;
7- import React from "react" ;
8+ import React , { useRef } from "react" ;
89
910const Introduction = ( ) => {
11+ const layoutRef = useRef < ResponsiveLayoutRef > ( null ) ;
1012 const scrollToSection = ( id : string ) => {
1113 const element = document . getElementById ( id ) ;
1214 if ( element ) {
1315 element . scrollIntoView ( { behavior : "smooth" } ) ;
1416 }
17+ layoutRef . current ?. closeSidebar ( ) ;
1518 } ;
1619
17- const sidebarItems : SidebarItem [ ] = [
20+ const sidebarItems : ResponsiveLayoutSidebarItem [ ] = [
1821 { id : "requisitos" , label : "Começando do Começo" , level : 0 } ,
1922 { id : "pacotes" , label : "Pacotes Principais" , level : 0 } ,
2023 { id : "constructo" , label : "Constructo" , level : 1 } ,
@@ -25,23 +28,9 @@ const Introduction = () => {
2528
2629 return (
2730 < ResponsiveLayout
31+ ref = { layoutRef }
2832 title = { "Começando do Começo" }
29- leftContent = {
30- < div >
31- { sidebarItems . map ( item => (
32- < button
33- key = { item . id }
34- onClick = { ( ) => scrollToSection ( item . id ) }
35- className = { cn (
36- "block w-full text-left transition-colors py-1 hover:text-primary" ,
37- item . level === 1 ? "ml-3 text-xs text-muted-foreground" : "text-sm" ,
38- ) }
39- >
40- { item . level === 1 ? `• ${ item . label } ` : item . label }
41- </ button >
42- ) ) }
43- </ div >
44- }
33+ leftContent = { < ResponsiveLayoutSidebar items = { sidebarItems } onItemClick = { scrollToSection } /> }
4534 rightContent = {
4635 < div className = "space-y-8" >
4736 < div className = "space-y-4" >
0 commit comments