update
This commit is contained in:
9
cli-center-docs/src/pages/demos/base.astro
Normal file
9
cli-center-docs/src/pages/demos/base.astro
Normal file
@@ -0,0 +1,9 @@
|
||||
---
|
||||
import Html from '@/components/html.astro';
|
||||
---
|
||||
|
||||
<Html>
|
||||
<main>
|
||||
|
||||
</main>
|
||||
</Html>
|
||||
10
cli-center-docs/src/pages/demos/vue.astro
Normal file
10
cli-center-docs/src/pages/demos/vue.astro
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
import Html from '@/components/html.astro';
|
||||
// import Counter from '@/components/vue/Counter.vue';
|
||||
---
|
||||
|
||||
<Html>
|
||||
<main>
|
||||
<!-- <Counter count={10} client:only/> -->
|
||||
</main>
|
||||
</Html>
|
||||
27
cli-center-docs/src/pages/docs/[...id].astro
Normal file
27
cli-center-docs/src/pages/docs/[...id].astro
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
import { getCollection, render } from 'astro:content';
|
||||
import Main from '@/layouts/mdx.astro';
|
||||
import { basename } from '@/modules/basename';
|
||||
// 1. 为每个集合条目生成一个新路径
|
||||
export async function getStaticPaths() {
|
||||
const posts = await getCollection('docs');
|
||||
return posts.map((post) => ({
|
||||
params: { id: post.id },
|
||||
props: { post },
|
||||
data: post,
|
||||
}));
|
||||
}
|
||||
type Post = {
|
||||
data: { title: string; tags: string[]; showMenu?: boolean };
|
||||
};
|
||||
// 2. 对于你的模板,你可以直接从 prop 获取条目
|
||||
const { post } = Astro.props as { post: Post };
|
||||
const { Content } = await render(post);
|
||||
const showMenu = post.data?.showMenu;
|
||||
const staticPaths = await getStaticPaths();
|
||||
const menu = staticPaths.map((item) => item.data);
|
||||
---
|
||||
|
||||
<Main showMenu={showMenu} menu={menu} basename={basename} title={post.data.title}>
|
||||
<Content />
|
||||
</Main>
|
||||
80
cli-center-docs/src/pages/docs/index.astro
Normal file
80
cli-center-docs/src/pages/docs/index.astro
Normal file
@@ -0,0 +1,80 @@
|
||||
---
|
||||
import { getCollection } from 'astro:content';
|
||||
const posts = await getCollection('docs');
|
||||
import { basename, wrapBasename } from '@/modules/basename';
|
||||
import Blank from '@/layouts/blank.astro';
|
||||
---
|
||||
|
||||
<Blank>
|
||||
<main class='min-h-screen bg-linear-to-br from-slate-50 to-slate-100 dark:from-slate-900 dark:to-slate-800'>
|
||||
<div class='max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-12'>
|
||||
{/* 页面标题区域 */}
|
||||
<div class='mb-12'>
|
||||
<h1 class='text-4xl sm:text-5xl font-bold text-slate-900 dark:text-white mb-4 bg-clip-text bg-linear-to-r from-blue-600 to-purple-600'>📚 文档列表</h1>
|
||||
<p class='text-slate-600 dark:text-slate-400 text-lg'>浏览所有可用的文档资源</p>
|
||||
<div class='mt-4 h-1 w-20 bg-linear-to-r from-blue-600 to-purple-600 rounded-full'></div>
|
||||
</div>
|
||||
|
||||
{/* 文档列表 */}
|
||||
<div class='space-y-4'>
|
||||
{
|
||||
posts.map((post) => {
|
||||
const tags = post.data.tags || [];
|
||||
const postUrl = wrapBasename(`/docs/${post.id}`);
|
||||
return (
|
||||
<article class='group bg-white dark:bg-slate-800 rounded-xl shadow-sm hover:shadow-xl transition-all duration-300 overflow-hidden border border-slate-200 dark:border-slate-700 hover:border-blue-500 dark:hover:border-blue-400'>
|
||||
<div class='p-6'>
|
||||
{/* 文档标题 */}
|
||||
<a href={postUrl} class='block'>
|
||||
<h2 class='text-xl sm:text-2xl font-semibold text-slate-900 dark:text-white group-hover:text-blue-600 dark:group-hover:text-blue-400 transition-colors duration-200 mb-3'>
|
||||
{post.data.title}
|
||||
</h2>
|
||||
</a>
|
||||
|
||||
{/* 文档描述(如果有) */}
|
||||
{post.data.description && <p class='text-slate-600 dark:text-slate-400 mb-4 line-clamp-2'>{post.data.description}</p>}
|
||||
|
||||
{/* 标签列表 */}
|
||||
{tags.length > 0 && (
|
||||
<div class='flex flex-wrap gap-2 mt-4'>
|
||||
{tags.map((tag) => (
|
||||
<div class='inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 hover:bg-blue-100 dark:hover:bg-blue-900/50 transition-colors duration-200 border border-blue-200 dark:border-blue-800'>
|
||||
<span class='mr-1'>#</span>
|
||||
{tag}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 阅读更多指示器 */}
|
||||
<a
|
||||
href={postUrl}
|
||||
class='mt-4 flex items-center text-blue-600 dark:text-blue-400 text-sm font-medium opacity-0 group-hover:opacity-100 transition-opacity duration-200'>
|
||||
<span>阅读更多</span>
|
||||
<svg
|
||||
class='w-4 h-4 ml-1 transform group-hover:translate-x-1 transition-transform duration-200'
|
||||
fill='none'
|
||||
viewBox='0 0 24 24'
|
||||
stroke='currentColor'>
|
||||
<path stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 5l7 7-7 7' />
|
||||
</svg>
|
||||
</a>
|
||||
</div>
|
||||
</article>
|
||||
);
|
||||
})
|
||||
}
|
||||
</div>
|
||||
|
||||
{/* 空状态 */}
|
||||
{
|
||||
posts.length === 0 && (
|
||||
<div class='text-center py-16'>
|
||||
<div class='text-6xl mb-4'>📭</div>
|
||||
<p class='text-xl text-slate-600 dark:text-slate-400'>暂无文档</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
</main>
|
||||
</Blank>
|
||||
120
cli-center-docs/src/pages/index.astro
Normal file
120
cli-center-docs/src/pages/index.astro
Normal file
@@ -0,0 +1,120 @@
|
||||
---
|
||||
import Html from '@/components/html.astro';
|
||||
---
|
||||
|
||||
<Html>
|
||||
<main class="container">
|
||||
<div class="hero">
|
||||
<h1 class="title">欢迎使用 CLI Center</h1>
|
||||
<p class="subtitle">强大的命令行工具管理中心</p>
|
||||
</div>
|
||||
|
||||
<div class="card-grid">
|
||||
<a href={"/root/cli/docs/"} class="card">
|
||||
<div class="card-icon">📚</div>
|
||||
<h2>文档中心</h2>
|
||||
<p>查看完整的使用文档和API参考</p>
|
||||
</a>
|
||||
|
||||
<a href={"/root/cli/settings/"} class="card">
|
||||
<div class="card-icon">⚙️</div>
|
||||
<h2>设置中心</h2>
|
||||
<p>配置和管理您的应用设置</p>
|
||||
</a>
|
||||
</div>
|
||||
</main>
|
||||
</Html>
|
||||
|
||||
<style>
|
||||
.container {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 3rem 1.5rem;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.hero {
|
||||
text-align: center;
|
||||
margin-bottom: 4rem;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 3.5rem;
|
||||
font-weight: 800;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
margin-bottom: 1rem;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 1.5rem;
|
||||
color: #6b7280;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.card-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
||||
gap: 2rem;
|
||||
width: 100%;
|
||||
max-width: 800px;
|
||||
}
|
||||
|
||||
.card {
|
||||
background: white;
|
||||
border-radius: 1rem;
|
||||
padding: 2.5rem;
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
||||
transition: all 0.3s ease;
|
||||
border: 2px solid transparent;
|
||||
}
|
||||
|
||||
.card:hover {
|
||||
transform: translateY(-8px);
|
||||
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
|
||||
border-color: #667eea;
|
||||
}
|
||||
|
||||
.card-icon {
|
||||
font-size: 3rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.card h2 {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
margin: 0 0 0.75rem 0;
|
||||
color: #111827;
|
||||
}
|
||||
|
||||
.card p {
|
||||
font-size: 1rem;
|
||||
color: #6b7280;
|
||||
margin: 0;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.title {
|
||||
font-size: 2.5rem;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
.card-grid {
|
||||
grid-template-columns: 1fr;
|
||||
max-width: 400px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
8
cli-center-docs/src/pages/settings.astro
Normal file
8
cli-center-docs/src/pages/settings.astro
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
import Html from '@/components/html.astro';
|
||||
import { FirstLogin } from '@/apps/settings/index.tsx';
|
||||
---
|
||||
|
||||
<Html>
|
||||
<FirstLogin client:only />
|
||||
</Html>
|
||||
8
cli-center-docs/src/pages/settings/all.astro
Normal file
8
cli-center-docs/src/pages/settings/all.astro
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
import Html from '@/components/html.astro';
|
||||
import { Config } from '@/apps/settings/index.tsx';
|
||||
---
|
||||
|
||||
<Html>
|
||||
<Config client:only />
|
||||
</Html>
|
||||
Reference in New Issue
Block a user