From 36bc8599328588556de5f2b3928857b18a846015 Mon Sep 17 00:00:00 2001 From: renan04lima Date: Tue, 5 Mar 2024 01:36:03 -0300 Subject: [PATCH] feat: accordion using island --- components/daisy/Accordion.tsx | 63 +++++++++++++++++++++------------- fresh.gen.ts | 2 ++ islands/Accordion.tsx | 8 +++++ sections/Content/Hero.tsx | 8 ++--- sections/Content/Pillars.tsx | 30 +++++++++------- 5 files changed, 71 insertions(+), 40 deletions(-) create mode 100644 islands/Accordion.tsx diff --git a/components/daisy/Accordion.tsx b/components/daisy/Accordion.tsx index a858473..d1f6449 100644 --- a/components/daisy/Accordion.tsx +++ b/components/daisy/Accordion.tsx @@ -1,45 +1,60 @@ -export interface Props { - children: Child[]; -} +import { useSignal } from "@preact/signals"; interface Child { title?: string; + /** @format textarea */ description?: string; } +export interface Props { + children2: Child[]; +} export default function Accordion(props: Props) { - const { children } = props; + const { children2 } = props; + const itemVisible = useSignal(0); + const len = children2.length; + const len2 = 8 * len; return ( <> - {children.map((c, index) => { + {children2.map((c, index) => { return ( -
(itemVisible.value = index)} > - -

+

{index + 1} -

-