generated from deco-sites/start
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7b7e35a
commit 958725d
Showing
13 changed files
with
7,992 additions
and
292 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
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 { useEffect } from "preact/hooks"; | ||
import { scroll, animate } from "motion"; | ||
|
||
const TABS = [ | ||
"Section Library", | ||
"No Code Editor", | ||
"Full Code Editor", | ||
"Web Analytics", | ||
"Monitoring", | ||
]; | ||
|
||
const PANELS = [ | ||
SectionLibrary, | ||
NoCodeEditor, | ||
FullCodeEditor, | ||
WebAnalytics, | ||
Monitoring, | ||
]; | ||
|
||
export const HeroEditorTabbed = () => { | ||
const selectedTab = useSignal(0); | ||
|
||
useEffect(() => { | ||
|
||
const element = document.querySelector("#hero"); | ||
|
||
if (!element) { | ||
return; | ||
} | ||
|
||
scroll( | ||
({ y }) => { | ||
console.log(y.progress) | ||
animate(".ellipse-1", { | ||
top: `${y.progress * 250 - 250}px`, | ||
}, { | ||
duration: 0, | ||
}); | ||
|
||
animate(".ellipse-2", { | ||
top: `calc(60% - ${y.progress * 50}px)`, | ||
}, { | ||
duration: 0, | ||
}); | ||
}, | ||
{ | ||
target: element, | ||
offset: ["0 0", "end end"], | ||
} | ||
); | ||
}, []); | ||
|
||
return ( | ||
<div class="lg:w-full lg:max-w-6xl py-4 lg:py-2 p-2 bg-white/5 border border-white/5 rounded-lg lg:rounded-3xl space-y-2 mx-2 lg:mx-0 z-40"> | ||
<div class="flex justify-center gap-x-8 gap-2 lg:gap-x-2 text-white flex-wrap items-center"> | ||
{TABS.map((tab, index) => ( | ||
<button | ||
onClick={() => { | ||
selectedTab.value = index; | ||
console.log(selectedTab.value); | ||
}} | ||
class={`text-[12px] lg:text-[18px] lg:px-[18px] py-2 font-medium ${ | ||
index === selectedTab.value | ||
? "text-[#02F67C] border-b border-[#02F67C]" | ||
: "text-white" | ||
}`} | ||
> | ||
{tab} | ||
</button> | ||
))} | ||
</div> | ||
<div>{PANELS[selectedTab.value]()} </div> | ||
</div> | ||
); | ||
}; |
Oops, something went wrong.