diff --git a/src/components/CodeExamplePackage.tsx b/src/components/CodeExamplePackage.tsx index c18e29f..a73c9cd 100644 --- a/src/components/CodeExamplePackage.tsx +++ b/src/components/CodeExamplePackage.tsx @@ -1,3 +1,4 @@ +import { useState } from "react"; import { Button } from "@/components/ui/button"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import CodeBlock from "@/components/CodeBlock"; @@ -14,7 +15,7 @@ interface PackageExampleProps { name: string; subtitle: string; description: string; - features: string[]; + features: (FeatureItem | string)[]; icon: React.ReactNode; gradientClass: string; shadowClass: string; @@ -24,6 +25,15 @@ interface PackageExampleProps { soon?: boolean; } +interface FeatureItem { + title: string; + description?: string; +} + +function normalizeFeature(feature: FeatureItem | string): FeatureItem { + return typeof feature === "string" ? { title: feature } : feature; +} + const CodeExamplePackage = ({ name, subtitle, @@ -37,10 +47,18 @@ const CodeExamplePackage = ({ reversed = false, soon = false, }: PackageExampleProps) => { + const [openFeature, setOpenFeature] = useState(null); + + const toggleFeature = (index: number) => { + setOpenFeature(openFeature === index ? null : index); + }; + const descriptionContent = (
-
+
{icon}
@@ -60,12 +78,51 @@ const CodeExamplePackage = ({
- {features.map((feature, index) => ( -
-
- {feature} -
- ))} + {features.map((feature, index) => { + const { title, description } = normalizeFeature(feature); + + const isOpen = openFeature === index; + + return ( +
+ {description ? ( + <> + + + {isOpen && ( +
+ {description} +
+ )} + + ) : ( +
+
+ {title} +
+ )} +
+ ); + })}
@@ -84,8 +141,12 @@ const CodeExamplePackage = ({
- {tabs.map(tab => ( - + {tabs.map((tab) => ( + {tab.label} ))} @@ -106,10 +167,10 @@ const CodeExamplePackage = ({ return (
- {descriptionContent.props.children} + {descriptionContent}
- {codeContent.props.children} + {codeContent}
); diff --git a/src/components/CodeExamples.tsx b/src/components/CodeExamples.tsx index 956c261..1251284 100644 --- a/src/components/CodeExamples.tsx +++ b/src/components/CodeExamples.tsx @@ -86,7 +86,23 @@ const CodeExamples = () => { name="Constructo" subtitle="Serialização Inteligente" description="Transforme dados em objetos tipados com validação automática. Classes que se serializam e se validam de forma elegante e eficiente." - features={["Serialização automática", "Validação integrada", "Type safety nativo"]} + features={[ + { + title: "Serialização automática", + description: + "Serialização avançada de objetos, permitindo a desconstrução de classes com objetos alinhados e realizando a tradução de tipos." + }, + { + title: "Validação integrada", + description: + "Junto com a serialização avançada e graças as tratativas internas, conseguimos realizar a validação de estruturas complexas por meio de processos encandeados com chains." + }, + { + title: "Type safety nativo", + description: + "Leva a tipagem da sua aplicação para outro nível!! Com o nosso sistema de tipagem, conseguimos ir além dos tipos nativos da linguagem, permitindo o uso de *attributes* personalizados, passando uma maior segurança e coesão na sua aplicação." + } + ]} icon={} gradientClass="bg-gradient-constructo" shadowClass="shadow-constructo"