diff --git a/packages/nextjs/components/ExtensionCardMini.tsx b/packages/nextjs/components/ExtensionCardMini.tsx new file mode 100644 index 0000000..a613946 --- /dev/null +++ b/packages/nextjs/components/ExtensionCardMini.tsx @@ -0,0 +1,46 @@ +import { useState } from "react"; +import { usePlausible } from "next-plausible"; +import CopyToClipboard from "react-copy-to-clipboard"; +import { CheckCircleIcon, DocumentDuplicateIcon } from "@heroicons/react/24/outline"; + +interface ExtensionCardMiniProps { + extension: { + name: string; + description: string; + installCommand: string; + }; +} + +export const ExtensionCardMini = ({ extension }: ExtensionCardMiniProps) => { + const [commandCopied, setCommandCopied] = useState(false); + const plausible = usePlausible(); + + const handleInstallClick = () => { + setCommandCopied(true); + setTimeout(() => { + setCommandCopied(false); + }, 800); + + // hardcoded to not mix stats with /extensions clicks + plausible("extensionCopyClick", { + props: { + id: `featured/${extension.name}`, + }, + }); + }; + + return ( +
+
+

{extension.name}

+

{extension.description}

+
+ + + +
+ ); +}; diff --git a/packages/nextjs/pages/index.tsx b/packages/nextjs/pages/index.tsx index 683c227..354a827 100644 --- a/packages/nextjs/pages/index.tsx +++ b/packages/nextjs/pages/index.tsx @@ -3,6 +3,7 @@ import Image from "next/image"; import type { NextPage } from "next"; import CopyToClipboard from "react-copy-to-clipboard"; import { CheckCircleIcon, DocumentDuplicateIcon } from "@heroicons/react/24/outline"; +import { ExtensionCardMini } from "~~/components/ExtensionCardMini"; import { HooksExample } from "~~/components/HooksExample"; import { MetaHeader } from "~~/components/MetaHeader"; import TrackedLink from "~~/components/TrackedLink"; @@ -10,13 +11,37 @@ import TrackedLink from "~~/components/TrackedLink"; const Home: NextPage = () => { const [npxCommandCopied, setNpxCommandCopied] = useState(false); const [extensionCommandCopied, setExtensionCommandCopied] = useState(false); + + const featuredExtensions = [ + { + name: "Ponder", + description: "Uses Ponder for powerful blockchain indexing", + installCommand: "npx create-eth@latest -e ponder", + }, + { + name: "ERC-20", + description: "Start with a simple ERC-20 token implementation", + installCommand: "npx create-eth@latest -e erc-20", + }, + { + name: "Subgraph", + description: "Integrate a subgraph for efficient data querying", + installCommand: "npx create-eth@latest -e subgraph", + }, + ]; + return ( <> {/* Hero section */}
@@ -59,24 +84,43 @@ const Home: NextPage = () => {
-
- -
- - Docs - - - Github - github icon - +
+ + Docs + + + Github + github icon + +
+
OR
+
+
New
+

+ Use one of our starter-kit{" "} + + extensions. + +

+
+
+ {featuredExtensions.map((extension, index) => ( + + ))} +
+

+ + Explore all the extensions + +

@@ -124,7 +168,7 @@ const Home: NextPage = () => { Accelerate your dapp development using our pre-built components for common web3 use cases. Tailwind and daisyUI to style your dapp and give it a modern and appealing design.

-

+

Check out all the components @@ -135,7 +179,7 @@ const Home: NextPage = () => { {/* Extensions Section */} -

+