initial commit
This commit is contained in:
136
src/components/navigation/NavigationGrid.astro
Normal file
136
src/components/navigation/NavigationGrid.astro
Normal file
@@ -0,0 +1,136 @@
|
||||
---
|
||||
export interface Props {
|
||||
title?: string;
|
||||
description?: string;
|
||||
columns?: number;
|
||||
gap?: 'small' | 'medium' | 'large';
|
||||
}
|
||||
|
||||
const {
|
||||
title,
|
||||
description,
|
||||
columns = 3,
|
||||
gap = 'medium'
|
||||
} = Astro.props;
|
||||
|
||||
const gapClasses = {
|
||||
small: 'gap-4',
|
||||
medium: 'gap-6',
|
||||
large: 'gap-8'
|
||||
};
|
||||
---
|
||||
|
||||
<section class="navigation-grid-container">
|
||||
{(title || description) && (
|
||||
<div class="grid-header">
|
||||
{title && <h2 class="grid-title">{title}</h2>}
|
||||
{description && <p class="grid-description">{description}</p>}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div class={`navigation-grid ${gapClasses[gap]}`} style={`--columns: ${columns}`}>
|
||||
<slot />
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<style>
|
||||
.navigation-grid-container {
|
||||
width: 100%;
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 2rem;
|
||||
}
|
||||
|
||||
.grid-header {
|
||||
text-align: center;
|
||||
margin-bottom: 3rem;
|
||||
animation: fadeIn 0.6s ease-out;
|
||||
}
|
||||
|
||||
.grid-title {
|
||||
font-size: 2.5rem;
|
||||
font-weight: 700;
|
||||
color: #7A6B5D;
|
||||
margin: 0 0 1rem 0;
|
||||
background: linear-gradient(135deg, #7A6B5D, #A68B7B);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
}
|
||||
|
||||
.grid-description {
|
||||
font-size: 1.1rem;
|
||||
color: #9B8B7A;
|
||||
margin: 0;
|
||||
line-height: 1.6;
|
||||
max-width: 600px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.navigation-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 响应式列数 */
|
||||
@media (min-width: 1200px) {
|
||||
.navigation-grid {
|
||||
grid-template-columns: repeat(var(--columns, 3), 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.navigation-grid-container {
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.navigation-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.grid-title {
|
||||
font-size: 2rem;
|
||||
}
|
||||
|
||||
.grid-description {
|
||||
font-size: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.grid-title {
|
||||
font-size: 1.75rem;
|
||||
}
|
||||
|
||||
.navigation-grid-container {
|
||||
padding: 0.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* 交错动画 */
|
||||
.navigation-grid > * {
|
||||
animation: fadeIn 0.6s ease-out;
|
||||
animation-fill-mode: both;
|
||||
}
|
||||
|
||||
.navigation-grid > *:nth-child(1) { animation-delay: 0.1s; }
|
||||
.navigation-grid > *:nth-child(2) { animation-delay: 0.2s; }
|
||||
.navigation-grid > *:nth-child(3) { animation-delay: 0.3s; }
|
||||
.navigation-grid > *:nth-child(4) { animation-delay: 0.4s; }
|
||||
.navigation-grid > *:nth-child(5) { animation-delay: 0.5s; }
|
||||
.navigation-grid > *:nth-child(6) { animation-delay: 0.6s; }
|
||||
.navigation-grid > *:nth-child(n+7) { animation-delay: 0.7s; }
|
||||
|
||||
@keyframes fadeIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(20px) scale(0.95);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0) scale(1);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user