refactor(Container): simplify container component and remove size prop
Remove size variants from Container component and set a default max-width Update all instances where Container was used with size prop to use default
This commit is contained in:
@@ -21,7 +21,7 @@ export default function Footer({ lang: propLang }: FooterProps) {
|
|||||||
const t = useTranslations(lang);
|
const t = useTranslations(lang);
|
||||||
return (
|
return (
|
||||||
<footer className="border-t border-purple-500/10 py-6 bg-gradient-to-b from-background to-muted/20 backdrop-blur-sm">
|
<footer className="border-t border-purple-500/10 py-6 bg-gradient-to-b from-background to-muted/20 backdrop-blur-sm">
|
||||||
<Container size="sm">
|
<Container>
|
||||||
<motion.div
|
<motion.div
|
||||||
className="flex flex-col md:flex-row justify-between items-center"
|
className="flex flex-col md:flex-row justify-between items-center"
|
||||||
initial={{ opacity: 0, y: 20 }}
|
initial={{ opacity: 0, y: 20 }}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export default function GlassHeader({ lang: propLang }: GlassHeaderProps) {
|
|||||||
? 'backdrop-blur-md backdrop-filter bg-white/80 dark:bg-black/80 border-b border-border/30 shadow-lg shadow-black/5 dark:shadow-black/20'
|
? 'backdrop-blur-md backdrop-filter bg-white/80 dark:bg-black/80 border-b border-border/30 shadow-lg shadow-black/5 dark:shadow-black/20'
|
||||||
: 'bg-transparent'
|
: 'bg-transparent'
|
||||||
}`}>
|
}`}>
|
||||||
<Container size="sm" className="p-4 flex justify-between items-center">
|
<Container className="p-4 flex justify-between items-center">
|
||||||
<a
|
<a
|
||||||
className="flex items-center text-lg font-medium transition-opacity duration-150 hover:opacity-80"
|
className="flex items-center text-lg font-medium transition-opacity duration-150 hover:opacity-80"
|
||||||
href={getLocalizedPath('/', lang)}
|
href={getLocalizedPath('/', lang)}
|
||||||
|
|||||||
@@ -4,33 +4,20 @@ import { type ReactNode } from "react";
|
|||||||
interface ContainerProps {
|
interface ContainerProps {
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
className?: string;
|
className?: string;
|
||||||
size?: "sm" | "md" | "lg" | "xl" | "full";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Container component for consistent content width across the site
|
* Container component for consistent content width across the site
|
||||||
* @param children - The content to be wrapped
|
* @param children - The content to be wrapped
|
||||||
* @param className - Additional classes to apply
|
* @param className - Additional classes to apply
|
||||||
* @param size - Container size variant (sm: max-w-4xl, md: max-w-6xl, lg: max-w-7xl, xl: max-w-screen-2xl, full: w-full)
|
|
||||||
*/
|
*/
|
||||||
export default function Container({
|
export default function Container({
|
||||||
children,
|
children,
|
||||||
className,
|
className
|
||||||
size = "md"
|
|
||||||
}: ContainerProps) {
|
}: ContainerProps) {
|
||||||
// Map size variants to max-width classes
|
|
||||||
const sizeClasses = {
|
|
||||||
sm: "max-w-4xl", // Same as header/footer (narrower content)
|
|
||||||
md: "max-w-6xl", // Default for most content areas
|
|
||||||
lg: "max-w-7xl", // For wider content like blog posts with sidebars
|
|
||||||
xl: "max-w-screen-2xl", // For very wide content
|
|
||||||
full: "w-full" // No max width constraint
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cn(
|
<div className={cn(
|
||||||
"container mx-auto px-4 sm:px-6 lg:px-8",
|
"container mx-auto px-4 sm:px-6 lg:px-8 max-w-6xl",
|
||||||
sizeClasses[size],
|
|
||||||
className
|
className
|
||||||
)}>
|
)}>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ const lang = Astro.currentLocale as Lang || defaultLang;
|
|||||||
|
|
||||||
<!-- Main content with proper spacing for fixed header -->
|
<!-- Main content with proper spacing for fixed header -->
|
||||||
<div class="pt-16 sm:pt-20">
|
<div class="pt-16 sm:pt-20">
|
||||||
<Container client:load size="md" className="py-8 md:py-12">
|
<Container client:load className="py-8 md:py-12">
|
||||||
<div class="max-w-7xl mx-auto">
|
<div class="max-w-7xl mx-auto">
|
||||||
<div class="grid grid-cols-1 xl:grid-cols-4 gap-6 lg:gap-8">
|
<div class="grid grid-cols-1 xl:grid-cols-4 gap-6 lg:gap-8">
|
||||||
<!-- Main Content -->
|
<!-- Main Content -->
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ const finalReadingTime = readTime ? parseInt(readTime.replace(/\D/g, '')) : unde
|
|||||||
|
|
||||||
<!-- Main content with proper spacing for fixed header -->
|
<!-- Main content with proper spacing for fixed header -->
|
||||||
<div class="pt-16 sm:pt-20">
|
<div class="pt-16 sm:pt-20">
|
||||||
<Container client:load size="md" className="py-6 sm:py-8">
|
<Container client:load className="py-6 sm:py-8">
|
||||||
<div class="max-w-7xl mx-auto">
|
<div class="max-w-7xl mx-auto">
|
||||||
<div class="grid grid-cols-1 xl:grid-cols-4 gap-6 lg:gap-8">
|
<div class="grid grid-cols-1 xl:grid-cols-4 gap-6 lg:gap-8">
|
||||||
<!-- Main Content -->
|
<!-- Main Content -->
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ const localizedText = getLocalizedText();
|
|||||||
---
|
---
|
||||||
|
|
||||||
<BlogLayout title={title} description={Astro.props.description}>
|
<BlogLayout title={title} description={Astro.props.description}>
|
||||||
<Container client:load size="md" className="py-8">
|
<Container client:load className="py-8">
|
||||||
<!-- Header Section - Centered at the top -->
|
<!-- Header Section - Centered at the top -->
|
||||||
<div class="text-center mb-10">
|
<div class="text-center mb-10">
|
||||||
<h1 class="text-4xl font-bold mb-3">
|
<h1 class="text-4xl font-bold mb-3">
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ const sortedBlogPosts = sortPostsByDate(blogPosts);
|
|||||||
<BlogLayout title="Blog - Joy Zhao" description="Dive into my thoughts on coding, tech trends, and developer life. Explore my latest posts below.">
|
<BlogLayout title="Blog - Joy Zhao" description="Dive into my thoughts on coding, tech trends, and developer life. Explore my latest posts below.">
|
||||||
<main class="min-h-screen">
|
<main class="min-h-screen">
|
||||||
<!-- Header Section -->
|
<!-- Header Section -->
|
||||||
<Container client:load size="md" className="pt-24 pb-12">
|
<Container client:load className="pt-24 pb-12">
|
||||||
<div class="text-center mb-16">
|
<div class="text-center mb-16">
|
||||||
<h1 class="text-5xl md:text-6xl font-bold bg-gradient-to-r from-foreground via-purple-600 to-purple-800 dark:from-foreground dark:via-purple-200 dark:to-purple-300 bg-clip-text text-transparent mb-6">
|
<h1 class="text-5xl md:text-6xl font-bold bg-gradient-to-r from-foreground via-purple-600 to-purple-800 dark:from-foreground dark:via-purple-200 dark:to-purple-300 bg-clip-text text-transparent mb-6">
|
||||||
Our <span class="text-purple-500">Latest</span> Blog
|
Our <span class="text-purple-500">Latest</span> Blog
|
||||||
@@ -56,7 +56,7 @@ const sortedBlogPosts = sortPostsByDate(blogPosts);
|
|||||||
</Container>
|
</Container>
|
||||||
|
|
||||||
<!-- Main Content -->
|
<!-- Main Content -->
|
||||||
<Container client:load size="md" className="pb-20">
|
<Container client:load className="pb-20">
|
||||||
<div class="grid grid-cols-1 lg:grid-cols-4 gap-8">
|
<div class="grid grid-cols-1 lg:grid-cols-4 gap-8">
|
||||||
<!-- 侧边栏 -->
|
<!-- 侧边栏 -->
|
||||||
<div class="lg:col-span-1 space-y-8">
|
<div class="lg:col-span-1 space-y-8">
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ const pageTitle = t('site.title');
|
|||||||
<!-- Background gradient -->
|
<!-- Background gradient -->
|
||||||
<div class="absolute inset-0 bg-gradient-to-br from-purple-900/20 via-purple-800/10 to-purple-700/20 dark:from-purple-900/30 dark:via-purple-800/20 dark:to-purple-700/30"></div>
|
<div class="absolute inset-0 bg-gradient-to-br from-purple-900/20 via-purple-800/10 to-purple-700/20 dark:from-purple-900/30 dark:via-purple-800/20 dark:to-purple-700/30"></div>
|
||||||
|
|
||||||
<Container client:load size="md" className="relative z-10">
|
<Container client:load className="relative z-10">
|
||||||
<div class="text-center mb-16">
|
<div class="text-center mb-16">
|
||||||
<!-- Greeting -->
|
<!-- Greeting -->
|
||||||
<div class="flex items-center justify-center mb-6">
|
<div class="flex items-center justify-center mb-6">
|
||||||
@@ -170,7 +170,7 @@ const pageTitle = t('site.title');
|
|||||||
|
|
||||||
<!-- Services Section - Inlined Content -->
|
<!-- Services Section - Inlined Content -->
|
||||||
<section id="services" class="py-20 bg-gradient-to-br from-slate-50 to-blue-50 dark:from-slate-900 dark:to-slate-800">
|
<section id="services" class="py-20 bg-gradient-to-br from-slate-50 to-blue-50 dark:from-slate-900 dark:to-slate-800">
|
||||||
<Container client:load size="md">
|
<Container client:load>
|
||||||
<h2 class="text-4xl font-bold text-center mb-16 bg-gradient-to-r from-blue-600 to-purple-600 bg-clip-text text-transparent">
|
<h2 class="text-4xl font-bold text-center mb-16 bg-gradient-to-r from-blue-600 to-purple-600 bg-clip-text text-transparent">
|
||||||
Services I Offer
|
Services I Offer
|
||||||
</h2>
|
</h2>
|
||||||
@@ -205,7 +205,7 @@ const pageTitle = t('site.title');
|
|||||||
<!-- Background gradient -->
|
<!-- Background gradient -->
|
||||||
<div class="absolute inset-0 bg-gradient-to-br from-blue-900/10 via-purple-800/5 to-indigo-700/10 dark:from-blue-900/20 dark:via-purple-800/10 dark:to-indigo-700/20"></div>
|
<div class="absolute inset-0 bg-gradient-to-br from-blue-900/10 via-purple-800/5 to-indigo-700/10 dark:from-blue-900/20 dark:via-purple-800/10 dark:to-indigo-700/20"></div>
|
||||||
|
|
||||||
<Container client:load size="md" className="relative z-10">
|
<Container client:load className="relative z-10">
|
||||||
<div class="text-center mb-16">
|
<div class="text-center mb-16">
|
||||||
<!-- Section Title -->
|
<!-- Section Title -->
|
||||||
<div class="flex items-center justify-center mb-6">
|
<div class="flex items-center justify-center mb-6">
|
||||||
@@ -340,7 +340,7 @@ const pageTitle = t('site.title');
|
|||||||
<!-- Background gradient -->
|
<!-- Background gradient -->
|
||||||
<div class="absolute inset-0 bg-gradient-to-b from-transparent via-purple-900/5 to-transparent"></div>
|
<div class="absolute inset-0 bg-gradient-to-b from-transparent via-purple-900/5 to-transparent"></div>
|
||||||
|
|
||||||
<Container client:load size="md" className="relative z-10">
|
<Container client:load className="relative z-10">
|
||||||
<div class="text-center mb-16">
|
<div class="text-center mb-16">
|
||||||
<h2 class="text-4xl md:text-5xl font-bold mb-4 bg-gradient-to-r from-purple-400 to-purple-600 bg-clip-text text-transparent">
|
<h2 class="text-4xl md:text-5xl font-bold mb-4 bg-gradient-to-r from-purple-400 to-purple-600 bg-clip-text text-transparent">
|
||||||
Latest Projects
|
Latest Projects
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ const currentProjects = projects[lang as keyof typeof projects] || projects.en;
|
|||||||
<!-- Background gradient -->
|
<!-- Background gradient -->
|
||||||
<div class="absolute inset-0 bg-gradient-to-br from-purple-900/20 via-purple-800/10 to-purple-700/20 dark:from-purple-900/30 dark:via-purple-800/20 dark:to-purple-700/30"></div>
|
<div class="absolute inset-0 bg-gradient-to-br from-purple-900/20 via-purple-800/10 to-purple-700/20 dark:from-purple-900/30 dark:via-purple-800/20 dark:to-purple-700/30"></div>
|
||||||
|
|
||||||
<Container client:load size="md" className="relative z-10">
|
<Container client:load className="relative z-10">
|
||||||
<div class="text-center mb-16">
|
<div class="text-center mb-16">
|
||||||
<!-- Main title -->
|
<!-- Main title -->
|
||||||
<h1 class="text-5xl md:text-6xl font-bold mb-6 bg-gradient-to-r from-gray-900 via-purple-600 to-purple-800 dark:from-white dark:via-purple-200 dark:to-purple-300 bg-clip-text text-transparent">
|
<h1 class="text-5xl md:text-6xl font-bold mb-6 bg-gradient-to-r from-gray-900 via-purple-600 to-purple-800 dark:from-white dark:via-purple-200 dark:to-purple-300 bg-clip-text text-transparent">
|
||||||
@@ -44,7 +44,7 @@ const currentProjects = projects[lang as keyof typeof projects] || projects.en;
|
|||||||
<!-- Background gradient -->
|
<!-- Background gradient -->
|
||||||
<div class="absolute inset-0 bg-gradient-to-b from-transparent via-purple-900/5 to-transparent"></div>
|
<div class="absolute inset-0 bg-gradient-to-b from-transparent via-purple-900/5 to-transparent"></div>
|
||||||
|
|
||||||
<Container client:load size="md" className="relative z-10">
|
<Container client:load className="relative z-10">
|
||||||
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8 items-stretch">
|
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8 items-stretch">
|
||||||
{currentProjects.map((project) => (
|
{currentProjects.map((project) => (
|
||||||
<div class={`group overflow-hidden border border-${project.color}-500/20 hover:border-${project.color}-500/40 h-full flex flex-col transition-all duration-500 hover:scale-105 bg-white/10 dark:bg-gray-800/50 backdrop-blur-sm rounded-xl relative`}>
|
<div class={`group overflow-hidden border border-${project.color}-500/20 hover:border-${project.color}-500/40 h-full flex flex-col transition-all duration-500 hover:scale-105 bg-white/10 dark:bg-gray-800/50 backdrop-blur-sm rounded-xl relative`}>
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ const tags = extractTags(allPostsArray);
|
|||||||
<BlogLayout title="博客 - 赵桂阳" description="深入我对编程、技术趋势和开发者生活的思考。探索我的最新文章。">
|
<BlogLayout title="博客 - 赵桂阳" description="深入我对编程、技术趋势和开发者生活的思考。探索我的最新文章。">
|
||||||
<main class="min-h-screen">
|
<main class="min-h-screen">
|
||||||
<!-- 头部区域 -->
|
<!-- 头部区域 -->
|
||||||
<Container client:load size="md" className="pt-24 pb-12">
|
<Container client:load className="pt-24 pb-12">
|
||||||
<div class="text-center mb-16">
|
<div class="text-center mb-16">
|
||||||
<h1 class="text-5xl md:text-6xl font-bold bg-gradient-to-r from-foreground via-purple-600 to-purple-800 dark:from-foreground dark:via-purple-200 dark:to-purple-300 bg-clip-text text-transparent mb-6">
|
<h1 class="text-5xl md:text-6xl font-bold bg-gradient-to-r from-foreground via-purple-600 to-purple-800 dark:from-foreground dark:via-purple-200 dark:to-purple-300 bg-clip-text text-transparent mb-6">
|
||||||
我的<span class="text-purple-500">博客</span>
|
我的<span class="text-purple-500">博客</span>
|
||||||
@@ -68,7 +68,7 @@ const tags = extractTags(allPostsArray);
|
|||||||
</Container>
|
</Container>
|
||||||
|
|
||||||
<!-- 主要内容 -->
|
<!-- 主要内容 -->
|
||||||
<Container client:load size="md" className="pb-20">
|
<Container client:load className="pb-20">
|
||||||
<div class="grid grid-cols-1 lg:grid-cols-4 gap-8">
|
<div class="grid grid-cols-1 lg:grid-cols-4 gap-8">
|
||||||
<!-- 侧边栏 -->
|
<!-- 侧边栏 -->
|
||||||
<div class="lg:col-span-1 space-y-8">
|
<div class="lg:col-span-1 space-y-8">
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ const pageTitle = t('site.title');
|
|||||||
<!-- Background gradient -->
|
<!-- Background gradient -->
|
||||||
<div class="absolute inset-0 bg-gradient-to-br from-purple-900/20 via-purple-800/10 to-purple-700/20 dark:from-purple-900/30 dark:via-purple-800/20 dark:to-purple-700/30"></div>
|
<div class="absolute inset-0 bg-gradient-to-br from-purple-900/20 via-purple-800/10 to-purple-700/20 dark:from-purple-900/30 dark:via-purple-800/20 dark:to-purple-700/30"></div>
|
||||||
|
|
||||||
<Container client:load size="md" className="relative z-10">
|
<Container client:load className="relative z-10">
|
||||||
<div class="text-center mb-16">
|
<div class="text-center mb-16">
|
||||||
<!-- Greeting -->
|
<!-- Greeting -->
|
||||||
<div class="flex items-center justify-center mb-6">
|
<div class="flex items-center justify-center mb-6">
|
||||||
@@ -171,7 +171,7 @@ const pageTitle = t('site.title');
|
|||||||
|
|
||||||
<!-- Services Section - Inlined Content -->
|
<!-- Services Section - Inlined Content -->
|
||||||
<section id="services" class="py-20 px-4 bg-gradient-to-br from-slate-50 to-blue-50 dark:from-slate-900 dark:to-slate-800">
|
<section id="services" class="py-20 px-4 bg-gradient-to-br from-slate-50 to-blue-50 dark:from-slate-900 dark:to-slate-800">
|
||||||
<Container client:load size="md">
|
<Container client:load>
|
||||||
<h2 class="text-4xl font-bold text-center mb-16 bg-gradient-to-r from-blue-600 to-purple-600 bg-clip-text text-transparent">
|
<h2 class="text-4xl font-bold text-center mb-16 bg-gradient-to-r from-blue-600 to-purple-600 bg-clip-text text-transparent">
|
||||||
我提供的服务
|
我提供的服务
|
||||||
</h2>
|
</h2>
|
||||||
@@ -206,7 +206,7 @@ const pageTitle = t('site.title');
|
|||||||
<!-- Background gradient -->
|
<!-- Background gradient -->
|
||||||
<div class="absolute inset-0 bg-gradient-to-br from-blue-900/10 via-purple-800/5 to-indigo-700/10 dark:from-blue-900/20 dark:via-purple-800/10 dark:to-indigo-700/20"></div>
|
<div class="absolute inset-0 bg-gradient-to-br from-blue-900/10 via-purple-800/5 to-indigo-700/10 dark:from-blue-900/20 dark:via-purple-800/10 dark:to-indigo-700/20"></div>
|
||||||
|
|
||||||
<Container client:load size="md" className="relative z-10">
|
<Container client:load className="relative z-10">
|
||||||
<div class="text-center mb-16">
|
<div class="text-center mb-16">
|
||||||
<!-- Section Title -->
|
<!-- Section Title -->
|
||||||
<div class="flex items-center justify-center mb-6">
|
<div class="flex items-center justify-center mb-6">
|
||||||
@@ -341,7 +341,7 @@ const pageTitle = t('site.title');
|
|||||||
<!-- Background gradient -->
|
<!-- Background gradient -->
|
||||||
<div class="absolute inset-0 bg-gradient-to-b from-transparent via-purple-900/5 to-transparent"></div>
|
<div class="absolute inset-0 bg-gradient-to-b from-transparent via-purple-900/5 to-transparent"></div>
|
||||||
|
|
||||||
<Container client:load size="md" className="relative z-10">
|
<Container client:load className="relative z-10">
|
||||||
<div class="text-center mb-16">
|
<div class="text-center mb-16">
|
||||||
<h2 class="text-4xl md:text-5xl font-bold mb-4 bg-gradient-to-r from-purple-400 to-purple-600 bg-clip-text text-transparent">
|
<h2 class="text-4xl md:text-5xl font-bold mb-4 bg-gradient-to-r from-purple-400 to-purple-600 bg-clip-text text-transparent">
|
||||||
我的项目
|
我的项目
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ const currentProjects = projects[lang as keyof typeof projects] || projects.en;
|
|||||||
<!-- Background gradient -->
|
<!-- Background gradient -->
|
||||||
<div class="absolute inset-0 bg-gradient-to-br from-purple-900/20 via-purple-800/10 to-purple-700/20 dark:from-purple-900/30 dark:via-purple-800/20 dark:to-purple-700/30"></div>
|
<div class="absolute inset-0 bg-gradient-to-br from-purple-900/20 via-purple-800/10 to-purple-700/20 dark:from-purple-900/30 dark:via-purple-800/20 dark:to-purple-700/30"></div>
|
||||||
|
|
||||||
<Container client:load size="md" className="relative z-10">
|
<Container client:load className="relative z-10">
|
||||||
<div class="text-center mb-16">
|
<div class="text-center mb-16">
|
||||||
<!-- Main title -->
|
<!-- Main title -->
|
||||||
<h1 class="text-5xl md:text-6xl font-bold mb-6 bg-gradient-to-r from-gray-900 via-purple-600 to-purple-800 dark:from-white dark:via-purple-200 dark:to-purple-300 bg-clip-text text-transparent">
|
<h1 class="text-5xl md:text-6xl font-bold mb-6 bg-gradient-to-r from-gray-900 via-purple-600 to-purple-800 dark:from-white dark:via-purple-200 dark:to-purple-300 bg-clip-text text-transparent">
|
||||||
@@ -44,7 +44,7 @@ const currentProjects = projects[lang as keyof typeof projects] || projects.en;
|
|||||||
<!-- Background gradient -->
|
<!-- Background gradient -->
|
||||||
<div class="absolute inset-0 bg-gradient-to-b from-transparent via-purple-900/5 to-transparent"></div>
|
<div class="absolute inset-0 bg-gradient-to-b from-transparent via-purple-900/5 to-transparent"></div>
|
||||||
|
|
||||||
<Container client:load size="md" className="relative z-10">
|
<Container client:load className="relative z-10">
|
||||||
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8 items-stretch">
|
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8 items-stretch">
|
||||||
{currentProjects.map((project) => (
|
{currentProjects.map((project) => (
|
||||||
<div class={`group overflow-hidden border border-${project.color}-500/20 hover:border-${project.color}-500/40 h-full flex flex-col transition-all duration-500 hover:scale-105 bg-white/10 dark:bg-gray-800/50 backdrop-blur-sm rounded-xl relative`}>
|
<div class={`group overflow-hidden border border-${project.color}-500/20 hover:border-${project.color}-500/40 h-full flex flex-col transition-all duration-500 hover:scale-105 bg-white/10 dark:bg-gray-800/50 backdrop-blur-sm rounded-xl relative`}>
|
||||||
|
|||||||
Reference in New Issue
Block a user