update menu

This commit is contained in:
2026-05-07 12:03:58 +08:00
parent 697d3773c8
commit 783779f4ae
8 changed files with 1155 additions and 229 deletions
+408 -10
View File
@@ -1,10 +1,414 @@
/* stylelint-disable docusaurus/copyright-header */
/**
* CSS files with the .module.css suffix will be treated as CSS modules
* and scoped locally.
*/
/* ══════════════════════════════════════════════════════════
Homepage Wrapper
══════════════════════════════════════════════════════════ */
.homepageWrapper {
display: flex;
flex-direction: column;
}
/* ══════════════════════════════════════════════════════════
Hero Background — dyte's noise-bg with grid pattern
══════════════════════════════════════════════════════════ */
.heroBg {
padding-bottom: 4rem;
background-color: #fafafa;
background-image:
linear-gradient(rgba(33, 96, 253, 0.03) 1px, transparent 1px),
linear-gradient(90deg, rgba(33, 96, 253, 0.03) 1px, transparent 1px);
background-size: 40px 40px;
border-bottom: 1px solid var(--ifm-toc-border-color);
}
[data-theme='dark'] .heroBg {
background-color: #111;
background-image:
linear-gradient(rgba(33, 96, 253, 0.06) 1px, transparent 1px),
linear-gradient(90deg, rgba(33, 96, 253, 0.06) 1px, transparent 1px);
background-size: 40px 40px;
}
/* ══════════════════════════════════════════════════════════
Hero Top Section (title + subtitle)
══════════════════════════════════════════════════════════ */
.heroTop {
padding: 5rem 1.5rem 3rem;
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
gap: 1rem;
}
.heroBadge {
display: inline-block;
padding: 0.3rem 0.9rem;
border-radius: 9999px;
border: 1px solid rgba(33, 96, 253, 0.35);
background: rgba(33, 96, 253, 0.08);
color: #2160fd;
font-size: 0.8rem;
font-weight: 600;
letter-spacing: 0.04em;
text-transform: uppercase;
}
[data-theme='dark'] .heroBadge {
background: rgba(33, 96, 253, 0.15);
color: #7a9eff;
border-color: rgba(33, 96, 253, 0.4);
}
.heroTitle {
font-size: 3.5rem;
font-weight: 800;
line-height: 1.1;
letter-spacing: -0.03em;
color: #0f172a;
margin: 0;
}
[data-theme='dark'] .heroTitle {
color: #f1f5f9;
}
.heroTitleAccent {
color: #2160fd;
}
[data-theme='dark'] .heroTitleAccent {
color: #7a9eff;
}
.heroSubtitle {
max-width: 560px;
font-size: 1.1rem;
line-height: 1.7;
color: #475569;
margin: 0;
}
[data-theme='dark'] .heroSubtitle {
color: #94a3b8;
}
.heroButtons {
display: flex;
gap: 0.75rem;
flex-wrap: wrap;
justify-content: center;
margin-top: 0.5rem;
}
.btnPrimary {
display: inline-flex;
align-items: center;
padding: 0.65rem 1.5rem;
border-radius: 8px;
background: #2160fd;
color: #fff !important;
font-weight: 600;
font-size: 0.95rem;
text-decoration: none !important;
transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
box-shadow: 0 2px 12px rgba(33, 96, 253, 0.35);
}
.btnPrimary:hover {
background: #1442c4;
transform: translateY(-1px);
box-shadow: 0 4px 20px rgba(33, 96, 253, 0.45);
color: #fff !important;
}
.btnOutline {
display: inline-flex;
align-items: center;
padding: 0.65rem 1.5rem;
border-radius: 8px;
border: 1.5px solid #cbd5e1;
background: transparent;
color: #334155 !important;
font-weight: 600;
font-size: 0.95rem;
text-decoration: none !important;
transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.btnOutline:hover {
border-color: #2160fd;
color: #2160fd !important;
background: rgba(33, 96, 253, 0.04);
}
[data-theme='dark'] .btnOutline {
border-color: #334155;
color: #cbd5e1 !important;
}
[data-theme='dark'] .btnOutline:hover {
border-color: #7a9eff;
color: #7a9eff !important;
}
/* ══════════════════════════════════════════════════════════
Hero Cards (dyte-style: dark bg + blue hover gradient)
══════════════════════════════════════════════════════════ */
.heroCards {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 1.25rem;
max-width: 1200px;
margin: 0 auto;
padding: 0 1.5rem;
}
/* The card itself is the <Link> */
.heroCard {
position: relative;
display: flex;
flex-direction: column;
justify-content: space-between;
width: 360px;
border-radius: 1.5rem; /* rounded-3xl */
border: 1px solid #e2e8f0; /* secondary-700 light */
background: #f8fafc; /* secondary-900 light */
overflow: hidden;
cursor: pointer;
text-decoration: none !important;
color: #0f172a !important;
transition: border-color 0.25s ease,
background 0.25s ease,
box-shadow 0.25s ease,
color 0.25s ease,
transform 0.2s ease;
}
[data-theme='dark'] .heroCard {
border-color: #1e293b; /* secondary-700 dark */
background: #0f172a; /* secondary-900 dark */
color: #f1f5f9 !important;
}
/* ── Hover State ───────────────────────────────────── */
.heroCard:hover {
border-color: #2160fd;
background: linear-gradient(
135deg,
rgba(33, 96, 253, 0.15) 0%,
transparent 60%
);
box-shadow: 0 0 0 1px rgba(33, 96, 253, 0.25),
0 8px 30px rgba(33, 96, 253, 0.12);
color: #2160fd !important;
transform: translateY(-3px);
}
[data-theme='dark'] .heroCard:hover {
background: linear-gradient(
135deg,
rgba(33, 96, 253, 0.25) 0%,
transparent 60%
);
}
.heroCardContent {
padding: 1.5rem;
display: flex;
flex-direction: column;
gap: 0.75rem;
flex: 1;
}
.heroCardHeader {
display: flex;
align-items: center;
gap: 0.75rem;
}
.heroCardEmoji {
font-size: 1.75rem;
line-height: 1;
width: 2.5rem;
height: 2.5rem;
display: flex;
align-items: center;
justify-content: center;
border-radius: 0.75rem;
background: rgba(33, 96, 253, 0.08);
flex-shrink: 0;
transition: background 0.25s, transform 0.2s;
}
.heroCard:hover .heroCardEmoji {
background: rgba(33, 96, 253, 0.18);
transform: scale(1.1);
}
.heroCardTitle {
font-size: 1.2rem;
font-weight: 700;
margin: 0;
color: #0f172a;
transition: color 0.25s;
}
[data-theme='dark'] .heroCardTitle {
color: #f1f5f9;
}
.heroCard:hover .heroCardTitle {
color: #2160fd;
}
[data-theme='dark'] .heroCard:hover .heroCardTitle {
color: #7a9eff;
}
.heroCardText {
font-size: 0.9rem;
line-height: 1.65;
color: #64748b;
margin: 0;
transition: color 0.25s;
}
[data-theme='dark'] .heroCardText {
color: #94a3b8;
}
.heroCard:hover .heroCardText {
color: #1e40af;
}
[data-theme='dark'] .heroCard:hover .heroCardText {
color: #93c5fd;
}
.heroCardTags {
display: flex;
flex-wrap: wrap;
gap: 0.4rem;
margin-top: 0.25rem;
}
.heroCardTag {
display: inline-block;
padding: 0.15rem 0.55rem;
border-radius: 4px;
background: rgba(33, 96, 253, 0.07);
color: #2160fd;
font-size: 0.72rem;
font-weight: 600;
transition: background 0.2s;
}
.heroCard:hover .heroCardTag {
background: rgba(33, 96, 253, 0.15);
}
[data-theme='dark'] .heroCardTag {
background: rgba(33, 96, 253, 0.12);
color: #7a9eff;
}
/* Arrow in top-right */
.heroCardArrow {
position: absolute;
top: 1.1rem;
right: 1.2rem;
font-size: 1.25rem;
opacity: 0;
transform: translate(6px, -6px);
color: #2160fd;
transition: opacity 0.25s, transform 0.25s;
}
.heroCard:hover .heroCardArrow {
opacity: 1;
transform: translate(0, 0);
}
/* ══════════════════════════════════════════════════════════
Feature Strip
══════════════════════════════════════════════════════════ */
.featuresStrip {
background: #fff;
border-bottom: 1px solid var(--ifm-toc-border-color);
padding: 2.5rem 1.5rem;
}
[data-theme='dark'] .featuresStrip {
background: #161616;
}
.featuresInner {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 1.5rem;
max-width: 1100px;
margin: 0 auto;
}
@media (max-width: 900px) {
.featuresInner {
grid-template-columns: repeat(2, 1fr);
}
}
@media (max-width: 480px) {
.featuresInner {
grid-template-columns: 1fr;
}
.heroCards {
flex-direction: column;
align-items: center;
}
.heroCard {
width: 100%;
max-width: 380px;
}
.heroTitle {
font-size: 2.2rem;
}
}
.featureItem {
display: flex;
align-items: flex-start;
gap: 0.8rem;
}
.featureIcon {
font-size: 1.6rem;
flex-shrink: 0;
margin-top: 0.1rem;
}
.featureTitle {
font-size: 0.9rem;
font-weight: 600;
color: #0f172a;
margin-bottom: 0.25rem;
}
[data-theme='dark'] .featureTitle {
color: #f1f5f9;
}
.featureDesc {
font-size: 0.8rem;
line-height: 1.5;
color: #64748b;
}
[data-theme='dark'] .featureDesc {
color: #94a3b8;
}
/* Legacy - kept for compatibility */
.heroBanner {
padding: 4rem 0;
text-align: center;
@@ -12,12 +416,6 @@
overflow: hidden;
}
@media screen and (max-width: 966px) {
.heroBanner {
padding: 2rem;
}
}
.buttons {
display: flex;
align-items: center;
+102 -38
View File
@@ -1,55 +1,119 @@
import React from 'react';
import clsx from 'clsx';
import Layout from '@theme/Layout';
import Link from '@docusaurus/Link';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import styles from './index.module.css';
import HomepageFeatures from '../components/HomepageFeatures';
function HomepageHeader(): JSX.Element {
const { siteConfig } = useDocusaurusContext();
/* ── Hero Cards ────────────────────────────────────────────── */
const HERO_CARDS = [
{
id: 'backend',
emoji: '⚙️',
title: '后端技术',
link: '/docs/backend-doc/intro-docs',
text: '深入讲解 Spring Boot / Spring Cloud 核心概念,微服务架构、分布式缓存与性能调优,含真实项目案例',
tags: ['Spring Boot', 'Spring Cloud', 'MySQL', 'Redis'],
},
{
id: 'frontend',
emoji: '⚛️',
title: '前端开发',
link: '/docs/frontend-doc/intro-docs',
text: '系统化学习 React / Vue 现代框架,工程化实践、状态管理与跨端开发,构建高质量前端应用',
tags: ['React', 'Vue 3', 'Vite', 'TypeScript'],
},
{
id: 'algorithms',
emoji: '🧠',
title: '算法与面试',
link: '/docs/LeetCode/intro-docs',
text: '精选 LeetCode 题解与数据结构深析,系统设计面试指南,快速突破大厂技术面试关卡',
tags: ['LeetCode', '数据结构', '系统设计', '剑指Offer'],
},
];
/* ── Feature List ───────────────────────────────────────────── */
const FEATURES = [
{ icon: '🔍', title: '全文搜索', desc: '集成 Algolia DocSearch,毫秒级检索,快速定位任意知识点' },
{ icon: '🌙', title: '深色模式', desc: '完整支持深色/浅色主题切换,护眼阅读体验' },
{ icon: '📱', title: '响应式设计', desc: '适配桌面、平板、手机,随时随地查阅技术文档' },
{ icon: '⚡', title: '持续更新', desc: '技术团队持续维护,同步最新技术栈与面试题解' },
];
function HeroCard({ emoji, title, link, text, tags }) {
return (
<header className={clsx('hero hero--primary', styles.heroBanner)}>
<div className="container">
<h1 className="hero__title">🚀 {siteConfig.title}</h1>
<p className="hero__subtitle">{siteConfig.tagline}</p>
<p style={{ fontSize: '0.95rem', color: 'rgba(0,0,0,0.6)', marginBottom: '1.5rem' }}>
<strong> + + </strong>
</p>
<div className={styles.buttons}>
<Link
className="button button--primary button--lg"
to="/docs/backend-doc/intro-docs">
</Link>
<Link
className="button button--secondary button--lg"
to="/docs/frontend-doc/intro-docs"
style={{ marginLeft: '1rem' }}>
</Link>
<Link
className="button button--outline button--lg"
to="/docs/LeetCode/intro-docs"
style={{ marginLeft: '1rem' }}>
🧠
</Link>
<Link to={link} className={styles.heroCard}>
<div className={styles.heroCardContent}>
<div className={styles.heroCardHeader}>
<span className={styles.heroCardEmoji}>{emoji}</span>
<h3 className={styles.heroCardTitle}>{title}</h3>
</div>
<p className={styles.heroCardText}>{text}</p>
<div className={styles.heroCardTags}>
{tags.map(tag => (
<span key={tag} className={styles.heroCardTag}>{tag}</span>
))}
</div>
</div>
</header>
<div className={styles.heroCardArrow}></div>
</Link>
);
}
function FeatureItem({ icon, title, desc }) {
return (
<div className={styles.featureItem}>
<span className={styles.featureIcon}>{icon}</span>
<div>
<div className={styles.featureTitle}>{title}</div>
<div className={styles.featureDesc}>{desc}</div>
</div>
</div>
);
}
export default function Home(): JSX.Element {
const { siteConfig } = useDocusaurusContext();
return (
<Layout
title={`Hello from ${siteConfig.title}`}
description="Description will go into a meta tag in <head />">
<HomepageHeader />
<main>
<HomepageFeatures />
</main>
title="CodeDocs — 全栈技术文档"
description="覆盖后端、前端、算法面试的一站式技术文档库,为全栈工程师打造"
wrapperClassName={styles.homepageWrapper}
>
{/* ── Hero ──────────────────────────────────────── */}
<div className={styles.heroBg}>
<section className={styles.heroTop}>
<span className={styles.heroBadge}></span>
<h1 className={styles.heroTitle}>
<span className={styles.heroTitleAccent}></span>
</h1>
<p className={styles.heroSubtitle}>
<strong> · · </strong>
</p>
<div className={styles.heroButtons}>
<Link className={styles.btnPrimary} to="/docs/backend-doc/intro-docs">
</Link>
<Link className={styles.btnOutline} to="/docs/intro-docs">
</Link>
</div>
</section>
{/* ── Hero Cards ────────────────────────────── */}
<section className={styles.heroCards}>
{HERO_CARDS.map(card => (
<HeroCard key={card.id} {...card} />
))}
</section>
</div>
{/* ── Feature Strip ────────────────────────────── */}
<section className={styles.featuresStrip}>
<div className={styles.featuresInner}>
{FEATURES.map(f => (
<FeatureItem key={f.title} {...f} />
))}
</div>
</section>
</Layout>
);
}