---
import Layout from '../../layouts/Layout.astro';

export async function getStaticPaths() {
  // Category slugs
  const slugs = [
    'en-qun-shu-wei-zui-xin-gong-gao',
    'xing-xiao-shi-shi-zui-qian-xian',
    'meta-xiao-xue-tang',
    'google-xiao-xue-tang'
  ];

  return slugs.map(slug => ({
    params: { slug },
    props: { slug }
  }));
}

const { slug } = Astro.props;

// Placeholder - would fetch category and posts from CMS
const category = {
  name: 'Category Name',
  posts: [
    { slug: 'post1', title: 'Post 1', date: '2023-01-01' }
  ]
};
---

<Layout>
  <section class="category-section">
    <div class="container">
      <h1>{category.name}</h1>
      <div class="posts-list">
        {category.posts.map(post => (
          <article class="post-item">
            <h2><a href={`/xing-xiao-fang-da-jing/${post.slug}`}>{post.title}</a></h2>
            <p>{post.date}</p>
          </article>
        ))}
      </div>
    </div>
  </section>
</Layout>

<style>
  .category-section {
    padding: 40px 0;
  }
  .container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
  }
  h1 {
    text-align: center;
    margin-bottom: 30px;
  }
  .posts-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
  }
  .post-item {
    border: 1px solid #ddd;
    padding: 20px;
    border-radius: 8px;
  }
  .post-item h2 {
    margin-top: 0;
  }
  .post-item a {
    text-decoration: none;
    color: #333;
  }
  .post-item a:hover {
    color: #007bff;
  }
</style>