Skip to content

Commit

Permalink
Logo metadata templates (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
rin-st authored Oct 14, 2024
1 parent 2270abb commit 9151c92
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changeset/purple-bulldogs-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-eth": patch
---

template: allow passing metadata & header logoText and description
13 changes: 7 additions & 6 deletions templates/base/packages/nextjs/app/layout.tsx.template.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { withDefaults } from "../../../../utils.js";

const contents = ({ imports }) => {
const contents = ({ imports, metadata }) => {
return `
${imports.filter(Boolean).join("\n")}
import "@rainbow-me/rainbowkit/styles.css";
Expand All @@ -9,10 +9,7 @@ import { ThemeProvider } from "~~/components/ThemeProvider";
import "~~/styles/globals.css";
import { getMetadata } from "~~/utils/scaffold-eth/getMetadata";
export const metadata = getMetadata({
title: "Scaffold-ETH 2 App",
description: "Built with 🏗 Scaffold-ETH 2",
});
export const metadata = getMetadata(${JSON.stringify(metadata[0])});
const ScaffoldEthApp = ({ children }: { children: React.ReactNode }) => {
return (
Expand All @@ -30,5 +27,9 @@ export default ScaffoldEthApp;`;
};

export default withDefaults(contents, {
imports: ""
imports: "",
metadata: {
title: "Scaffold-ETH 2 App",
description: "Built with 🏗 Scaffold-ETH 2"
}
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { withDefaults } from "../../../../utils.js";
const contents = ({ menuIconImports, menuObjects }) => {
const contents = ({ menuIconImports, menuObjects, logoText, logoDescription }) => {
const stringifiedAdditionalMenuLinks = menuObjects.filter(Boolean).join(",\n");

return `"use client";
import React, { useCallback, useRef, useState } from "react";
Expand All @@ -22,12 +24,12 @@ export const menuLinks: HeaderMenuLink[] = [
label: "Home",
href: "/",
},
${stringifiedAdditionalMenuLinks && `${stringifiedAdditionalMenuLinks},`}
{
label: "Debug Contracts",
href: "/debug",
icon: <BugAntIcon className="h-4 w-4" />,
},
${menuObjects.filter(Boolean).join(",\n")}
];
export const HeaderMenuLinks = () => {
Expand Down Expand Up @@ -97,8 +99,8 @@ export const Header = () => {
<Image alt="SE2 logo" className="cursor-pointer" fill src="/logo.svg" />
</div>
<div className="flex flex-col">
<span className="font-bold leading-tight">Scaffold-ETH</span>
<span className="text-xs">Ethereum dev stack</span>
<span className="font-bold leading-tight">${logoText}</span>
<span className="text-xs">${logoDescription}</span>
</div>
</Link>
<ul className="hidden lg:flex lg:flex-nowrap menu menu-horizontal px-1 gap-2">
Expand All @@ -117,4 +119,6 @@ export const Header = () => {
export default withDefaults(contents, {
menuIconImports: "",
menuObjects: "",
logoText: "Scaffold-ETH",
logoDescription: "Ethereum dev stack"
});

0 comments on commit 9151c92

Please sign in to comment.