From 64dd189f9dbe9de232e9e628364b8a1809ab6f02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ricles?= Date: Tue, 9 Jan 2024 10:25:06 -0300 Subject: [PATCH] refactor: use images for editor tabbed --- islands/NRF/HeroEditorTabbed.tsx | 73 +++++++++++++++----------------- sections/NRF/Hero.tsx | 11 +++-- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/islands/NRF/HeroEditorTabbed.tsx b/islands/NRF/HeroEditorTabbed.tsx index 8318d78e..0ddad423 100644 --- a/islands/NRF/HeroEditorTabbed.tsx +++ b/islands/NRF/HeroEditorTabbed.tsx @@ -1,52 +1,47 @@ import { useSignal } from "@preact/signals"; -import { SectionLibrary } from "deco-sites/starting/components/nrf/hero/SectionLibrary.tsx"; -import { NoCodeEditor } from "deco-sites/starting/components/nrf/hero/NoCodeEditor.tsx"; -import { FullCodeEditor } from "deco-sites/starting/components/nrf/hero/FullCodeEditor.tsx"; -import { WebAnalytics } from "deco-sites/starting/components/nrf/hero/WebAnalytics.tsx"; -import { Monitoring } from "deco-sites/starting/components/nrf/hero/Monitoring.tsx"; +import type { ImageWidget } from "apps/admin/widgets.ts"; -const TABS = [ - "Section Library", - "No Code Editor", - "Full Code Editor", - "Web Analytics", - "Monitoring", -]; +export interface Tab { + title: string; + image: ImageWidget; +} -const PANELS = [ - SectionLibrary, - NoCodeEditor, - FullCodeEditor, - WebAnalytics, - Monitoring, -]; +export interface Props { + tabs?: Tab[]; +} -export const HeroEditorTabbed = () => { +export const HeroEditorTabbed = ({ tabs }: Props) => { const selectedTab = useSignal(0); return (
- {TABS.map((tab, index) => ( - - ))} + {tabs && + tabs.map((tab, index) => ( + + ))}
- {PANELS.map((panel, index) => ( -
- {panel()} -
- ))} + {tabs && + tabs.map((tab, index) => ( +
+ {tab.title} +
+ ))}
); diff --git a/sections/NRF/Hero.tsx b/sections/NRF/Hero.tsx index b58f1e8b..576e724a 100644 --- a/sections/NRF/Hero.tsx +++ b/sections/NRF/Hero.tsx @@ -1,4 +1,7 @@ -import { HeroEditorTabbed } from "deco-sites/starting/islands/NRF/HeroEditorTabbed.tsx"; +import { + HeroEditorTabbed, + Tab, +} from "deco-sites/starting/islands/NRF/HeroEditorTabbed.tsx"; import type { ImageWidget } from "apps/admin/widgets.ts"; interface CTA { @@ -6,6 +9,7 @@ interface CTA { text: string; variant: "Normal" | "Reverse"; } + export interface Props { /** * @format html @@ -22,9 +26,10 @@ export interface Props { mobileText?: string; href?: string; }; + tabs?: Tab[]; } -export default function Hero({ title, subtitle, cta, alert }: Props) { +export default function Hero({ title, subtitle, cta, alert, tabs }: Props) { return (
- +
);