From 7cc88406b0cb6cc454e89df88b2538af09741d00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=AC=A2?= Date: Wed, 28 Aug 2024 18:24:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../[locale]/(marketing)/cursor/layout.tsx | 57 +++++++++++++-- src/components/layout/navbar.tsx | 69 +++++++------------ src/components/sections/hero-landing.tsx | 51 +++++--------- src/locales/cn.json | 2 +- 4 files changed, 97 insertions(+), 82 deletions(-) diff --git a/src/app/[locale]/(marketing)/cursor/layout.tsx b/src/app/[locale]/(marketing)/cursor/layout.tsx index 6a93a204..7cf32a56 100644 --- a/src/app/[locale]/(marketing)/cursor/layout.tsx +++ b/src/app/[locale]/(marketing)/cursor/layout.tsx @@ -1,16 +1,65 @@ +"use client"; + +import { useEffect, useState } from "react"; +import { MenuIcon, XIcon } from "lucide-react"; import { ThemeProvider } from "next-themes"; + +import { Button } from "@/components/ui/button"; import { Menu } from "@/components/cursor/menu"; export default function Layout({ children }: { children: React.ReactNode }) { + const [isMenuOpen, setIsMenuOpen] = useState(false); + const [isMobile, setIsMobile] = useState(false); + + useEffect(() => { + const checkIsMobile = () => { + setIsMobile(window.innerWidth < 768); + }; + + checkIsMobile(); + window.addEventListener("resize", checkIsMobile); + + return () => window.removeEventListener("resize", checkIsMobile); + }, []); + return ( -
-
- +
+ {/* 移动端菜单切换按钮 */} + {isMobile && ( + + )} + + {/* 侧边菜单 */} +
+
+ +
-
+ + {/* 主内容区 */} +
{children}
+ + {/* 遮罩层 */} + {isMobile && isMenuOpen && ( +
setIsMenuOpen(false)} + /> + )}
); diff --git a/src/components/layout/navbar.tsx b/src/components/layout/navbar.tsx index 78b05990..b3bea2d6 100644 --- a/src/components/layout/navbar.tsx +++ b/src/components/layout/navbar.tsx @@ -78,57 +78,38 @@ export function NavBar({ scroll = false }: NavBarProps) { ) : null}
-
- {/* right header for docs */} - {documentation ? ( -
-
- -
-
- -
-
- +
+ + {session ? ( + +
-
- ) : null} - - {session ? ( - + Dashboard + + + + ) : status === "unauthenticated" ? ( - - ) : status === "unauthenticated" ? ( - - ) : ( - - )} + ) : ( + + )} +
diff --git a/src/components/sections/hero-landing.tsx b/src/components/sections/hero-landing.tsx index 4762131a..0e702ec0 100644 --- a/src/components/sections/hero-landing.tsx +++ b/src/components/sections/hero-landing.tsx @@ -1,13 +1,13 @@ +import { useTranslations } from "next-intl"; import Link from "next/link"; -import { env } from "@/env.mjs"; -import { siteConfig } from "@/config/site"; -import { cn, nFormatter } from "@/lib/utils"; -import { buttonVariants } from "@/components/ui/button"; + import { Icons } from "@/components/shared/icons"; -import { useTranslations } from 'next-intl'; +import { buttonVariants } from "@/components/ui/button"; +import { env } from "@/env.mjs"; +import { cn } from "@/lib/utils"; export default async function HeroLanding() { - const t = useTranslations('HeroLanding'); + const t = useTranslations("HeroLanding"); const { stargazers_count: stars } = await fetch( "https://api.github.com/repos/mickasmt/next-saas-stripe-starter", { @@ -36,14 +36,14 @@ export default async function HeroLanding() { target="_blank" > 🎉 - {t('introducing')}  Next Auth - Roles Template on + {t("introducing")}  Next + Auth Roles Template on

- {t('kickoff')}{" "} + {t("kickoff")}{" "} - {t('saasStarter')} + {t("saasStarter")}

@@ -51,7 +51,7 @@ export default async function HeroLanding() { className="max-w-2xl text-balance leading-normal text-muted-foreground sm:text-xl sm:leading-8" style={{ animationDelay: "0.35s", animationFillMode: "forwards" }} > - {t('description')} + {t("description")}

- {t('goPricing')} + {t("goPricing")} - -

- {t('starOn')} {t('github')}{" "} - {nFormatter(stars)} -

- - - {t('goCursorRules')} + {t("goCursorRules")}
); -} \ No newline at end of file +} diff --git a/src/locales/cn.json b/src/locales/cn.json index 6952a0c5..ed208260 100644 --- a/src/locales/cn.json +++ b/src/locales/cn.json @@ -10,7 +10,7 @@ "goPricing": "查看定价", "starOn": "在", "github": "GitHub 上加星", - "goCursorRules": "去查看 Cursor 提示词" + "goCursorRules": "Go Cursor Rules" }, "layout": { "english": "英文",