@coffic/cosy-ui 0.8.28 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,71 +5,73 @@ import { type ISidebarItem } from '../types/sidebar';
5
5
  * 用于构建网站的侧边栏导航
6
6
  */
7
7
  export class SidebarItemEntity implements ISidebarItem {
8
- text: string;
9
- href: string;
10
- items: ISidebarItem[];
8
+ text: string;
9
+ href: string;
10
+ items: ISidebarItem[];
11
+ badge?: string | number;
11
12
 
12
- constructor(props: { text: string; link?: string; items?: ISidebarItem[] }) {
13
- this.text = props.text;
14
- this.href = props.link || '';
15
- this.items = props.items || [];
16
- }
13
+ constructor(props: { text: string; link?: string; items?: ISidebarItem[]; badge?: string | number }) {
14
+ this.text = props.text;
15
+ this.href = props.link || '';
16
+ this.items = props.items || [];
17
+ this.badge = props.badge;
18
+ }
17
19
 
18
- /**
19
- * 添加子项目
20
- * @param item 要添加的子项目
21
- */
22
- addItem(item: SidebarItemEntity): void {
23
- this.items.push(item);
24
- }
20
+ /**
21
+ * 添加子项目
22
+ * @param item 要添加的子项目
23
+ */
24
+ addItem(item: SidebarItemEntity): void {
25
+ this.items.push(item);
26
+ }
25
27
 
26
- /**
27
- * 获取所有子项目
28
- * @returns 子项目数组
29
- */
30
- getItems(): SidebarItemEntity[] {
31
- return this.items.map((item) => new SidebarItemEntity(item));
32
- }
28
+ /**
29
+ * 获取所有子项目
30
+ * @returns 子项目数组
31
+ */
32
+ getItems(): SidebarItemEntity[] {
33
+ return this.items.map((item) => new SidebarItemEntity(item));
34
+ }
33
35
 
34
- /**
35
- * 获取项目标签
36
- * @returns 项目标签
37
- */
38
- getLabel(): string {
39
- return this.text;
40
- }
36
+ /**
37
+ * 获取项目标签
38
+ * @returns 项目标签
39
+ */
40
+ getLabel(): string {
41
+ return this.text;
42
+ }
41
43
 
42
- /**
43
- * 获取项目链接
44
- * @returns 项目链接
45
- */
46
- getLink(): string {
47
- return this.href;
48
- }
44
+ /**
45
+ * 获取项目链接
46
+ * @returns 项目链接
47
+ */
48
+ getLink(): string {
49
+ return this.href;
50
+ }
49
51
 
50
- /**
51
- * 获取包括自身在内的所有项目
52
- * @returns 包括自身在内的所有项目
53
- */
54
- getItemsIncludingSelf(): SidebarItemEntity[] {
55
- return [this, ...this.getItems()];
56
- }
52
+ /**
53
+ * 获取包括自身在内的所有项目
54
+ * @returns 包括自身在内的所有项目
55
+ */
56
+ getItemsIncludingSelf(): SidebarItemEntity[] {
57
+ return [this, ...this.getItems()];
58
+ }
57
59
 
58
- /**
59
- * 判断是否是分组(有子项目)
60
- * @returns 是否是分组
61
- */
62
- isGroup(): boolean {
63
- return this.items.length > 0;
64
- }
60
+ /**
61
+ * 判断是否是分组(有子项目)
62
+ * @returns 是否是分组
63
+ */
64
+ isGroup(): boolean {
65
+ return this.items.length > 0;
66
+ }
65
67
 
66
- /**
67
- * 判断是否不是分组
68
- * @returns 是否不是分组
69
- */
70
- isNotGroup(): boolean {
71
- return !this.isGroup();
72
- }
68
+ /**
69
+ * 判断是否不是分组
70
+ * @returns 是否不是分组
71
+ */
72
+ isNotGroup(): boolean {
73
+ return !this.isGroup();
74
+ }
73
75
  }
74
76
 
75
77
  /**
@@ -77,13 +79,13 @@ export class SidebarItemEntity implements ISidebarItem {
77
79
  * 实现此接口的类可以提供侧边栏项目
78
80
  */
79
81
  export interface SidebarProvider {
80
- /**
81
- * 转换为侧边栏项目
82
- */
83
- toSidebarItem(): Promise<SidebarItemEntity>;
82
+ /**
83
+ * 转换为侧边栏项目
84
+ */
85
+ toSidebarItem(): Promise<SidebarItemEntity>;
84
86
 
85
- /**
86
- * 获取顶级侧边栏项目
87
- */
88
- getTopSidebarItem?(): Promise<SidebarItemEntity>;
87
+ /**
88
+ * 获取顶级侧边栏项目
89
+ */
90
+ getTopSidebarItem?(): Promise<SidebarItemEntity>;
89
91
  }
@@ -176,6 +176,7 @@ import {
176
176
  } from '../../index-astro';
177
177
  import FooterSection from './FooterSection.astro';
178
178
  import '../../style.ts';
179
+ import FooterCopyright from './FooterCopyright.astro';
179
180
 
180
181
  const {
181
182
  siteName,
@@ -367,17 +368,11 @@ const debugClasses = debug
367
368
  }
368
369
 
369
370
  {/* 底部版权信息 */}
370
- <div
371
- class:list={[
372
- 'cosy:footer cosy:footer-center cosy:p-4 cosy:bg-base-300',
373
- debugClasses.footer,
374
- ]}>
375
- <aside
376
- class:list={['cosy:items-center cosy:grid-flow-col', debugClasses.aside]}>
377
- <p class="cosy:opacity-70 cosy:text-sm">
378
- © {currentYear}
379
- {company} - {copyright || t('allRightsReserved')}
380
- </p>
381
- {icp && <p class="cosy:opacity-70 cosy:ml-4 cosy:text-sm">{icp}</p>}
382
- </aside>
383
- </div>
371
+ <FooterCopyright
372
+ company={company}
373
+ copyright={copyright}
374
+ icp={icp}
375
+ currentYear={currentYear}
376
+ t={t}
377
+ debugClasses={debugClasses}
378
+ />
@@ -0,0 +1,29 @@
1
+ ---
2
+ /**
3
+ * @component FooterCopyright
4
+ * @description 页脚底部版权信息组件。
5
+ * @props
6
+ * @prop {string} company - 公司名称
7
+ * @prop {string} copyright - 版权信息
8
+ * @prop {string} icp - ICP备案号(可选)
9
+ * @prop {number} currentYear - 当前年份
10
+ * @prop {Function} t - 文本获取函数
11
+ * @prop {object} debugClasses - 调试样式类
12
+ */
13
+ const { company, copyright, icp, currentYear, t, debugClasses } = Astro.props;
14
+ ---
15
+
16
+ <div
17
+ class:list={[
18
+ 'cosy:footer cosy:footer-center cosy:p-4 cosy:bg-base-300',
19
+ debugClasses?.footer,
20
+ ]}>
21
+ <aside
22
+ class:list={['cosy:items-center cosy:grid-flow-col', debugClasses?.aside]}>
23
+ <p class="cosy:opacity-70 cosy:text-sm">
24
+ © {currentYear}
25
+ {company} - {copyright || (t && t('allRightsReserved'))}
26
+ </p>
27
+ {icp && <p class="cosy:opacity-70 cosy:ml-4 cosy:text-sm">{icp}</p>}
28
+ </aside>
29
+ </div>
@@ -33,6 +33,9 @@ const { title, links } = Astro.props;
33
33
  <Link
34
34
  href={link.href}
35
35
  size="sm"
36
+ ghost
37
+ btn
38
+ color="primary"
36
39
  target={link.external ? '_blank' : '_self'}
37
40
  variant="text">
38
41
  {link.name}
@@ -22,8 +22,9 @@ import {
22
22
  Link,
23
23
  Image,
24
24
  ThemeSwitcher,
25
- } from '@coffic/cosy-ui';
25
+ } from '../../index-astro';
26
26
  import Logo from '../../src/assets/logo-rounded.png';
27
+ import { i18n } from 'astro:config/server';
27
28
 
28
29
  export interface Props extends IHeaderProps {
29
30
  debug?: boolean;
@@ -31,7 +32,6 @@ export interface Props extends IHeaderProps {
31
32
 
32
33
  const {
33
34
  height = 'md',
34
- languages = ['zh-cn', 'en'],
35
35
  logo = Logo,
36
36
  logoHref = '/',
37
37
  navItems = [],
@@ -200,7 +200,7 @@ const activeLink = LinkUtil.getActiveLink(
200
200
  }
201
201
 
202
202
  {showThemeSwitcher && <ThemeSwitcher />}
203
- {languages.length > 1 && <LanguageSwitcher languages={languages} />}
203
+ {i18n !== undefined && <LanguageSwitcher />}
204
204
 
205
205
  <slot name="navbar-end" />
206
206
  </div>
@@ -19,50 +19,59 @@
19
19
  * <LanguageSwitcher />
20
20
  * ```
21
21
  *
22
- * 自定义语言列表:
23
- * ```astro
24
- * <LanguageSwitcher
25
- * languages={['zh-cn', 'en']}
26
- * />
27
- * ```
28
22
  */
29
23
 
30
- import { ChevronDownIcon, LanguageUtil } from '../../index-astro';
24
+ import {
25
+ ChevronDownIcon,
26
+ LanguageUtil,
27
+ Link,
28
+ ListItem,
29
+ } from '../../index-astro';
31
30
  import '../../style.ts';
31
+ import { i18n } from 'astro:config/server';
32
32
 
33
33
  interface Props {
34
- languages: string[];
35
34
  /**
36
35
  * 自定义类名
37
36
  */
38
37
  class?: string;
39
38
  }
40
39
 
41
- const { languages = ['zh-cn', 'en'], class: className = '' } = Astro.props;
40
+ const { class: className = '' } = Astro.props;
41
+
42
+ let links: any[] = [];
43
+ let currentLocale: string | undefined = undefined;
44
+ let currentLanguageName: string | undefined = undefined;
42
45
 
43
- const currentLocale = Astro.currentLocale;
44
- const currentLanguageName = LanguageUtil.getLanguageName(currentLocale);
46
+ if (i18n !== undefined) {
47
+ const { getSwitcherLinks } = await import('./switcher_util.ts');
48
+ links = getSwitcherLinks(Astro);
49
+
50
+ currentLocale = Astro.currentLocale!;
51
+ currentLanguageName = LanguageUtil.getLanguageName(currentLocale);
52
+ } else {
53
+ throw new Error('can not use LanguageSwitcher when i18n is disabled');
54
+ }
45
55
  ---
46
56
 
47
- <!-- 语言切换按钮 -->
48
- <div class={`cosy:dropdown cosy:dropdown-end ${className}`}>
49
- <div tabindex="0" role="button" class:list={['cosy:btn cosy:btn-ghost']}>
50
- <span class="cosy:mr-1">{currentLanguageName}</span>
51
- <ChevronDownIcon size="16px" class="cosy:w-4 cosy:h-4" />
52
- </div>
53
- <ul
54
- tabindex="0"
55
- class="cosy:z-[1] cosy:bg-base-100 cosy:shadow cosy:p-2 cosy:rounded-box cosy:w-32 cosy:dropdown-content cosy:menu">
56
- {
57
- languages.map((lang) => (
58
- <li class={currentLocale === lang ? 'cosy:disabled' : ''}>
59
- <a
60
- href={LanguageUtil.getRelativeLink(lang, Astro)}
61
- class={currentLocale === lang ? 'cosy:active' : ''}>
62
- {LanguageUtil.getLanguageName(lang)}
63
- </a>
64
- </li>
65
- ))
66
- }
67
- </ul>
68
- </div>
57
+ {
58
+ i18n !== undefined && (
59
+ <div class={`cosy:dropdown cosy:dropdown-end ${className}`}>
60
+ <div tabindex="0" role="button" class:list={['cosy:btn cosy:btn-ghost']}>
61
+ <span class="cosy:mr-1">{currentLanguageName}</span>
62
+ <ChevronDownIcon size="16px" class="cosy:w-4 cosy:h-4" />
63
+ </div>
64
+ <ul
65
+ tabindex="0"
66
+ class="cosy:z-[1] cosy:bg-base-100 cosy:shadow cosy:p-2 cosy:rounded-box cosy:w-32 cosy:dropdown-content cosy:menu">
67
+ {links.map((link) => (
68
+ <ListItem>
69
+ <Link href={link.url} active={currentLocale === link.locale}>
70
+ {link.name}
71
+ </Link>
72
+ </ListItem>
73
+ ))}
74
+ </ul>
75
+ </div>
76
+ )
77
+ }
@@ -1,11 +1,3 @@
1
1
  import LanguageSwitcher from './LanguageSwitcher.astro';
2
- import LanguageSwitcherBasic from './LanguageSwitcherBasic.astro';
3
- import BasicSourceCode from './LanguageSwitcherBasic.astro?raw';
4
- import { extractSimpleExample } from '../../src/utils/component';
5
2
 
6
- export { LanguageSwitcher, LanguageSwitcherBasic };
7
-
8
- // 导出示例源代码
9
- export const LanguageSwitcherExampleCodes = {
10
- Basic: extractSimpleExample(BasicSourceCode, 'LanguageSwitcher'),
11
- };
3
+ export { LanguageSwitcher };
@@ -0,0 +1,40 @@
1
+ import { getRelativeLocaleUrl, getRelativeLocaleUrlList } from 'astro:i18n';
2
+ import type { AstroGlobal } from 'astro';
3
+ import { LanguageUtil } from '../../index-astro';
4
+
5
+ export interface SwitcherLink {
6
+ locale: string;
7
+ name: string;
8
+ url: string;
9
+ }
10
+
11
+ // 获取基础路径
12
+ const getBaseUrl = (): string => {
13
+ return import.meta.env.BASE_URL;
14
+ };
15
+
16
+ const getLocaleFromUrl = (url: string): string => {
17
+ return url.replace(getBaseUrl(), '').split('/')[0];
18
+ };
19
+
20
+ export function getSwitcherLinks(astro: AstroGlobal): SwitcherLink[] {
21
+ const currentLocale = astro.currentLocale;
22
+
23
+ if (currentLocale === undefined) {
24
+ throw new Error('can not get switcher links when i18n is disabled');
25
+ }
26
+
27
+ const currentLocalURLPrefix = getRelativeLocaleUrl(currentLocale, '');
28
+ const pathname = astro.url.pathname + '/';
29
+ const slug = pathname.replace(
30
+ currentLocalURLPrefix,
31
+ ''
32
+ );
33
+ const urls = getRelativeLocaleUrlList(slug);
34
+
35
+ return urls.map((url) => ({
36
+ locale: getLocaleFromUrl(url),
37
+ name: LanguageUtil.getLanguageName(getLocaleFromUrl(url)),
38
+ url: url
39
+ }));
40
+ }
@@ -260,6 +260,12 @@ export interface Props {
260
260
  * @default false
261
261
  */
262
262
  debug?: boolean;
263
+
264
+ /**
265
+ * 主内容区 padding 尺寸
266
+ * @default 'md'
267
+ */
268
+ mainPadding?: 'none' | 'sm' | 'md' | 'lg' | 'xl';
263
269
  }
264
270
 
265
271
  const {
@@ -273,18 +279,27 @@ const {
273
279
  sidebarCollapsed = false,
274
280
  sidebarSize = 'md',
275
281
  sidebarTheme = 'default',
276
- mainBackgroundTheme = 'transparent',
282
+ mainBackgroundTheme = 'base-100',
277
283
  enableToast = true,
278
284
  enableConfirmDialog = true,
279
285
  head,
280
286
  class: className,
281
287
  'class:list': classList,
282
288
  debug = false,
289
+ mainPadding = 'md',
283
290
  ...rest
284
291
  } = Astro.props;
285
292
 
286
293
  const currentPath = Astro.url.pathname;
287
294
  const mainBackgroundStyles = getMainBackgroundTheme(mainBackgroundTheme);
295
+
296
+ const mainPaddingMap = {
297
+ none: '',
298
+ sm: 'cosy:p-2',
299
+ md: 'cosy:p-4',
300
+ lg: 'cosy:p-8',
301
+ xl: 'cosy:p-12',
302
+ };
288
303
  ---
289
304
 
290
305
  <BaseLayout
@@ -328,7 +343,11 @@ const mainBackgroundStyles = getMainBackgroundTheme(mainBackgroundTheme);
328
343
 
329
344
  <!-- 页面内容 -->
330
345
  <main
331
- class:list={['cosy:flex-1 cosy:p-4 cosy:lg:p-6', mainBackgroundStyles]}>
346
+ class:list={[
347
+ 'cosy:flex-1',
348
+ mainPaddingMap[mainPadding],
349
+ mainBackgroundStyles,
350
+ ]}>
332
351
  <slot />
333
352
  </main>
334
353
  </div>
@@ -159,8 +159,8 @@ export const mainBackgroundThemeMap: Record<MainBackgroundTheme, string> = {
159
159
  * @param theme 主内容区域背景主题
160
160
  * @returns 对应的样式类名
161
161
  */
162
- export function getMainBackgroundTheme(theme: MainBackgroundTheme = 'transparent'): string {
162
+ export function getMainBackgroundTheme(theme: MainBackgroundTheme = 'base-100'): string {
163
163
  return mainBackgroundThemeMap[theme];
164
164
  }
165
165
 
166
- export { getIconFromHref, getNavItemIcon, getUserMenuItemIcon } from './tools';
166
+ export { getIconFromHref, getNavItemIcon, getUserMenuItemIcon } from './tools';
@@ -100,6 +100,7 @@ interface Props extends HTMLAttributes<'a'> {
100
100
  | 'warning'
101
101
  | 'error';
102
102
  align?: 'left' | 'center' | 'right';
103
+ active?: boolean;
103
104
  }
104
105
 
105
106
  const {
@@ -121,6 +122,7 @@ const {
121
122
  fullWidth = false,
122
123
  color,
123
124
  align,
125
+ active = false,
124
126
  ...rest
125
127
  } = Astro.props;
126
128
 
@@ -159,7 +161,10 @@ const classes = [
159
161
  animation === 'hover-scale' &&
160
162
  'cosy:hover:scale-105 cosy:transition-transform',
161
163
 
162
- // 新增:按钮风格
164
+ // Active state
165
+ active && 'cosy:active',
166
+
167
+ // 按钮风格
163
168
  btn && 'cosy:btn',
164
169
  btn && size === 'sm' && 'cosy:btn-sm',
165
170
  btn && size === 'lg' && 'cosy:btn-lg',
@@ -1,10 +1,35 @@
1
1
  ---
2
2
  /**
3
3
  * @component ListItem
4
- * @description List item component with loading animations
5
- * @props loading?: boolean
6
- * @props duration?: number
7
- * @props animationType?: string
4
+ *
5
+ * @description
6
+ * ListItem 组件用于在列表中显示单个项目。它内置了多种加载动画效果,可以方便地通过 `loading` 属性来控制加载状态,并通过 `loadingAnimationType` 属性切换不同的加载Loading动画样式。
7
+ *
8
+ * @usage
9
+ * 基本用法:
10
+ * ```astro
11
+ * <ListItem>这是一个列表项</ListItem>
12
+ * ```
13
+ *
14
+ * 加载状态:
15
+ * ```astro
16
+ * <ListItem loading={true}>加载中的列表项</ListItem>
17
+ * ```
18
+ *
19
+ * 指定加载动画类型:
20
+ * ```astro
21
+ * <ListItem loading={true} loadingAnimationType="pulse">使用脉冲动画加载</ListItem>
22
+ * <ListItem loading={true} loadingAnimationType="icon-left">使用左侧图标动画加载</ListItem>
23
+ * ```
24
+ *
25
+ * @props
26
+ * @prop {string} [class] - 自定义 CSS 类名。
27
+ * @prop {boolean} [loading=false] - 控制是否显示加载动画。
28
+ * @prop {number} [duration] - 动画的持续时间(单位:毫秒)。
29
+ * @prop {('none'|'ring'|'icon-left'|'icon-right'|'breath'|'pulse'|'glow')} [loadingAnimationType='none'] - 加载动画的类型。
30
+ *
31
+ * @slots
32
+ * @slot default - 列表项的内容。
8
33
  */
9
34
  import '../../style.ts';
10
35
  import ListItemRing from './ListItemRing.astro';
@@ -14,16 +39,38 @@ import ListItemBreath from './ListItemBreath.astro';
14
39
  import ListItemPulse from './ListItemPulse.astro';
15
40
  import ListItemGlow from './ListItemGlow.astro';
16
41
 
42
+ interface Props {
43
+ class?: string;
44
+ loading?: boolean;
45
+ duration?: number;
46
+ loadingAnimationType?:
47
+ | 'none'
48
+ | 'ring'
49
+ | 'icon-left'
50
+ | 'icon-right'
51
+ | 'breath'
52
+ | 'pulse'
53
+ | 'glow';
54
+ }
55
+
17
56
  const {
18
57
  loading = false,
19
58
  duration,
20
- animationType = 'ring',
59
+ loadingAnimationType = 'none',
21
60
  ...restProps
22
61
  } = Astro.props;
23
62
  ---
24
63
 
25
64
  {
26
- animationType === 'ring' && (
65
+ loadingAnimationType === 'none' && (
66
+ <li {...restProps}>
67
+ <slot />
68
+ </li>
69
+ )
70
+ }
71
+
72
+ {
73
+ loadingAnimationType === 'ring' && (
27
74
  <ListItemRing loading={loading} duration={duration} {...restProps}>
28
75
  <slot />
29
76
  </ListItemRing>
@@ -31,7 +78,7 @@ const {
31
78
  }
32
79
 
33
80
  {
34
- animationType === 'icon-left' && (
81
+ loadingAnimationType === 'icon-left' && (
35
82
  <ListItemIconLeft loading={loading} duration={duration} {...restProps}>
36
83
  <slot />
37
84
  </ListItemIconLeft>
@@ -39,7 +86,7 @@ const {
39
86
  }
40
87
 
41
88
  {
42
- animationType === 'icon-right' && (
89
+ loadingAnimationType === 'icon-right' && (
43
90
  <ListItemIconRight loading={loading} duration={duration} {...restProps}>
44
91
  <slot />
45
92
  </ListItemIconRight>
@@ -47,7 +94,7 @@ const {
47
94
  }
48
95
 
49
96
  {
50
- animationType === 'breath' && (
97
+ loadingAnimationType === 'breath' && (
51
98
  <ListItemBreath loading={loading} duration={duration} {...restProps}>
52
99
  <slot />
53
100
  </ListItemBreath>
@@ -55,7 +102,7 @@ const {
55
102
  }
56
103
 
57
104
  {
58
- animationType === 'pulse' && (
105
+ loadingAnimationType === 'pulse' && (
59
106
  <ListItemPulse loading={loading} duration={duration} {...restProps}>
60
107
  <slot />
61
108
  </ListItemPulse>
@@ -63,7 +110,7 @@ const {
63
110
  }
64
111
 
65
112
  {
66
- animationType === 'glow' && (
113
+ loadingAnimationType === 'glow' && (
67
114
  <ListItemGlow loading={loading} duration={duration} {...restProps}>
68
115
  <slot />
69
116
  </ListItemGlow>
@@ -75,6 +75,11 @@ const debugClass = debug ? 'cosy:border cosy:border-red-500' : '';
75
75
  debugClass,
76
76
  ]}>
77
77
  {item.text}
78
+ {item.badge !== undefined && item.badge !== null && (
79
+ <span class="cosy:badge cosy:badge-sm cosy:ml-2">
80
+ {item.badge}
81
+ </span>
82
+ )}
78
83
  </a>
79
84
  {item.items && (
80
85
  <ul class:list={[debugClass]}>
@@ -95,6 +100,12 @@ const debugClass = debug ? 'cosy:border cosy:border-red-500' : '';
95
100
  debugClass,
96
101
  ]}>
97
102
  {subitem.text}
103
+ {subitem.badge !== undefined &&
104
+ subitem.badge !== null && (
105
+ <span class="cosy:badge cosy:badge-xs cosy:ml-2">
106
+ {subitem.badge}
107
+ </span>
108
+ )}
98
109
  </a>
99
110
  {subitem.items && (
100
111
  <ul class:list={[debugClass]}>
@@ -115,6 +126,12 @@ const debugClass = debug ? 'cosy:border cosy:border-red-500' : '';
115
126
  debugClass,
116
127
  ]}>
117
128
  {subsubitem.text}
129
+ {subsubitem.badge !== undefined &&
130
+ subsubitem.badge !== null && (
131
+ <span class="cosy:badge cosy:badge-xs cosy:ml-2">
132
+ {subsubitem.badge}
133
+ </span>
134
+ )}
118
135
  </a>
119
136
  </li>
120
137
  );
@@ -1,11 +1,4 @@
1
1
  import Sidebar from './Sidebar.astro';
2
- import SidebarBasic from './SidebarBasic.astro';
3
- import BasicSourceCode from './SidebarBasic.astro?raw';
4
- import { extractSimpleExample } from '../../src/utils/component';
2
+ import SidebarNav from './SidebarNav.astro';
5
3
 
6
- export { Sidebar, SidebarBasic };
7
-
8
- // 导出示例源代码
9
- export const SidebarExampleCodes = {
10
- Basic: extractSimpleExample(BasicSourceCode, 'Sidebar'),
11
- };
4
+ export { Sidebar, SidebarNav };