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:
joyzhao
2025-06-19 18:26:05 +08:00
parent 5fcf7a9d33
commit f4ff971c85
12 changed files with 23 additions and 36 deletions

View File

@@ -21,7 +21,7 @@ export default function Footer({ lang: propLang }: FooterProps) {
const t = useTranslations(lang);
return (
<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
className="flex flex-col md:flex-row justify-between items-center"
initial={{ opacity: 0, y: 20 }}

View File

@@ -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'
: 'bg-transparent'
}`}>
<Container size="sm" className="p-4 flex justify-between items-center">
<Container className="p-4 flex justify-between items-center">
<a
className="flex items-center text-lg font-medium transition-opacity duration-150 hover:opacity-80"
href={getLocalizedPath('/', lang)}

View File

@@ -4,33 +4,20 @@ import { type ReactNode } from "react";
interface ContainerProps {
children: ReactNode;
className?: string;
size?: "sm" | "md" | "lg" | "xl" | "full";
}
/**
* Container component for consistent content width across the site
* @param children - The content to be wrapped
* @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({
children,
className,
size = "md"
className
}: 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 (
<div className={cn(
"container mx-auto px-4 sm:px-6 lg:px-8",
sizeClasses[size],
"container mx-auto px-4 sm:px-6 lg:px-8 max-w-6xl",
className
)}>
{children}