refactor(structure): reorganize page and component exports

- Move root page from /(app) to / directory
- Convert default exports to named exports in components
- Rename MainView component to HeroSection for better semantics
This commit is contained in:
2025-05-07 14:06:31 +08:00
parent 3417d2ee49
commit 1db666a2ab
7 changed files with 38 additions and 34 deletions
-17
View File
@@ -1,17 +0,0 @@
import FAQs from "@/components/faqs";
import { Header } from "@/components/header";
import { Footer } from "@/components/footer";
import { MainView } from "@/components/main-view";
import { PrimaryFeatures } from "@/components/primary-features";
export default function HomePage() {
return (
<>
<Header />
<MainView />
<PrimaryFeatures />
<FAQs />
<Footer />
</>
)
}
+15
View File
@@ -0,0 +1,15 @@
import { FAQs } from "@/components/faqs";
import { Header } from "@/components/header";
import { Footer } from "@/components/footer";
import { HeroSection } from "@/components/hero-section";
import { PrimaryFeatures } from "@/components/primary-features";
export default function RootPage() {
<>
<Header />
<HeroSection />
<PrimaryFeatures />
<FAQs />
<Footer />
</>;
}
+5 -3
View File
@@ -1,6 +1,6 @@
import { useTranslations } from "next-intl";
export default function FAQs() {
const FAQs = () => {
const t = useTranslations("HomePage.FAQs");
const faqs = [
@@ -23,7 +23,7 @@ export default function FAQs() {
id: 4,
question: t("questions.question4"),
answer: t("questions.answer4"),
}
},
];
return (
<div className="border-t">
@@ -53,4 +53,6 @@ export default function FAQs() {
</div>
</div>
);
}
};
export { FAQs };
+4 -2
View File
@@ -20,7 +20,7 @@ const navigation = {
],
};
export function Footer() {
const Footer = () => {
return (
<footer>
<Container>
@@ -44,4 +44,6 @@ export function Footer() {
</Container>
</footer>
);
}
};
export { Footer };
+4 -2
View File
@@ -4,7 +4,7 @@ import { Container } from "@/components/container";
import { ThemeToggle } from "@/components/theme-toggle";
import { LanguageSettings } from "@/components/language-settings";
export async function Header() {
const Header = () => {
return (
<header>
<nav>
@@ -22,4 +22,6 @@ export async function Header() {
</nav>
</header>
);
}
};
export { Header };
@@ -6,7 +6,7 @@ import { Button } from "@/components/ui/button";
import { Container } from "@/components/container";
import { TypingEffect } from "@/components/typing-effect";
export function MainView() {
const HeroSection = () => {
const t = useTranslations("HomePage.MainView");
return (
@@ -29,17 +29,13 @@ export function MainView() {
className="rounded-2xl bg-muted text-muted-foreground shadow hover:bg-muted/50"
asChild
>
<Link href="/problemset" prefetch>
{t("quickStart")}
</Link>
<Link href="/problemset">{t("quickStart")}</Link>
</Button>
<Button
size="sm"
className="rounded-2xl bg-accent text-accent-foreground shadow hover:bg-accent/50"
>
<Link href={siteConfig.url.repo.github}>
{t("contactUs")}
</Link>
<Link href={siteConfig.url.repo.github}>{t("contactUs")}</Link>
</Button>
</div>
</div>
@@ -59,4 +55,6 @@ export function MainView() {
</Container>
</div>
);
}
};
export { HeroSection };
+4 -2
View File
@@ -93,7 +93,7 @@ const LSPCard = () => {
);
};
export function PrimaryFeatures() {
const PrimaryFeatures = () => {
const t = useTranslations("HomePage.PrimaryFeatures");
return (
@@ -110,4 +110,6 @@ export function PrimaryFeatures() {
</div>
</div>
);
}
};
export { PrimaryFeatures };