@windrun-huaiin/third-ui 5.1.4 → 5.2.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windrun-huaiin/third-ui",
3
- "version": "5.1.4",
3
+ "version": "5.2.0",
4
4
  "description": "Third-party integrated UI components for windrun-huaiin projects",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -53,7 +53,7 @@
53
53
  "mermaid": "^11.6.0",
54
54
  "react-medium-image-zoom": "^5.2.14",
55
55
  "zod": "^3.22.4",
56
- "@windrun-huaiin/base-ui": "^5.1.2"
56
+ "@windrun-huaiin/base-ui": "^5.2.0"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "react": "19.1.0",
@@ -9,4 +9,6 @@ export * from './gradient-button';
9
9
  export * from './toc';
10
10
  export * from './toc-base';
11
11
  export * from './fuma-banner-suit';
12
- export * from './fuma-github-info';
12
+ export * from './fuma-github-info';
13
+ export * from './site-x';
14
+ export * from './zia-file';
@@ -0,0 +1,54 @@
1
+ 'use client';
2
+
3
+ import { cn } from '@lib/utils';
4
+ import type { HTMLAttributes } from 'react';
5
+ import { useTranslations } from 'next-intl';
6
+
7
+ export type SiteXProps = Omit<HTMLAttributes<HTMLSpanElement>, 'type'> & {
8
+ type: 'site' | 'email';
9
+ namespace?: string;
10
+ tKey?: string;
11
+ };
12
+
13
+ export function SiteX({ type, namespace, tKey, className, ...props }: SiteXProps) {
14
+ // 默认命名空间和key
15
+ let ns = namespace;
16
+ let key = tKey;
17
+ if (!ns) {
18
+ ns = type === 'site' ? 'home' : 'footer';
19
+ }
20
+ if (!key) {
21
+ key = type === 'site' ? 'title' : 'email';
22
+ }
23
+ const t = useTranslations(ns);
24
+ const text = t(key, { defaultValue: type === 'site' ? 'Site----' : '----@example.com' });
25
+
26
+ if (type === 'site') {
27
+ return (
28
+ <strong
29
+ {...props}
30
+ className={cn(
31
+ 'font-extrabold text-sm',
32
+ className
33
+ )}
34
+ >
35
+ {text}
36
+ </strong>
37
+ );
38
+ }
39
+ if (type === 'email') {
40
+ return (
41
+ <a
42
+ {...props}
43
+ href={`mailto:${text}`}
44
+ className={cn(
45
+ 'font-mono underline text-sm',
46
+ className
47
+ )}
48
+ >
49
+ {text}
50
+ </a>
51
+ );
52
+ }
53
+ return null;
54
+ }
@@ -1,9 +1,10 @@
1
1
  'use client';
2
2
 
3
+ import { globalLucideIcons as icons } from '@base-ui/components/global-icon';
3
4
  import React from 'react';
4
5
 
5
6
  export function TrophyCard({
6
- icon,
7
+ icon = <icons.Star />,
7
8
  title,
8
9
  children,
9
10
  }: {
@@ -0,0 +1,83 @@
1
+ import { globalLucideIcons as icons } from '@base-ui/components/global-icon';
2
+ import { type HTMLAttributes, type ReactNode, useState } from 'react';
3
+ import { cn } from '@lib/utils';
4
+ import {
5
+ Collapsible,
6
+ CollapsibleContent,
7
+ CollapsibleTrigger,
8
+ } from 'fumadocs-ui/components/ui/collapsible';
9
+ import React from 'react';
10
+
11
+ const itemVariants = 'flex flex-row items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-fd-accent hover:text-fd-accent-foreground [&_svg]:size-4';
12
+
13
+ // 注解样式:色彩突出且主题适配
14
+ const anotionClass = 'ms-2 px-2 py-0.5 rounded text-xs font-semibold bg-fd-accent/80 text-fd-accent-foreground dark:bg-white/20 dark:text-white';
15
+
16
+ export interface ZiaFileProps extends HTMLAttributes<HTMLDivElement> {
17
+ name: string;
18
+ icon?: ReactNode;
19
+ anotion?: string;
20
+ href?: string;
21
+ }
22
+
23
+ export interface ZiaFolderProps extends HTMLAttributes<HTMLDivElement> {
24
+ name: string;
25
+ anotion?: string;
26
+ disabled?: boolean;
27
+ defaultOpen?: boolean;
28
+ }
29
+
30
+ export function ZiaFile({
31
+ name,
32
+ icon = <icons.File />,
33
+ className,
34
+ anotion,
35
+ href,
36
+ ...rest
37
+ }: ZiaFileProps): React.ReactElement {
38
+ const validHref = typeof href === 'string' && href.trim() !== '';
39
+ const Comp: React.ElementType = validHref ? 'a' : 'div';
40
+ const validAnotion = typeof anotion === 'string' && anotion.trim() !== '';
41
+ return React.createElement(
42
+ Comp,
43
+ {
44
+ className: cn(itemVariants, className),
45
+ ...(validHref ? { href, target: '_blank', rel: 'noopener noreferrer' } : {}),
46
+ ...rest,
47
+ },
48
+ <>
49
+ {icon}
50
+ <span>{name}</span>
51
+ {validAnotion && (
52
+ <span className={anotionClass}>{anotion}</span>
53
+ )}
54
+ </>
55
+ );
56
+ }
57
+
58
+ export function ZiaFolder({
59
+ name,
60
+ anotion,
61
+ defaultOpen = false,
62
+ className,
63
+ children,
64
+ ...props
65
+ }: ZiaFolderProps): React.ReactElement {
66
+ const [open, setOpen] = useState(defaultOpen);
67
+ const validAnotion = typeof anotion === 'string' && anotion.trim() !== '';
68
+
69
+ return (
70
+ <Collapsible open={open} onOpenChange={setOpen} {...props}>
71
+ <CollapsibleTrigger className={cn(itemVariants, className, 'w-full')}>
72
+ {open ? <icons.FolderOpen /> : <icons.Folder />}
73
+ <span>{name}</span>
74
+ {validAnotion && (
75
+ <span className={anotionClass}>{anotion}</span>
76
+ )}
77
+ </CollapsibleTrigger>
78
+ <CollapsibleContent>
79
+ <div className="ms-2 flex flex-col border-l ps-2">{children}</div>
80
+ </CollapsibleContent>
81
+ </Collapsible>
82
+ );
83
+ }
package/src/main/cta.tsx CHANGED
@@ -6,7 +6,7 @@ import { useTranslations } from 'next-intl';
6
6
  export function CTA() {
7
7
  const t = useTranslations('cta');
8
8
  return (
9
- <section className="container mx-auto px-4 py-20">
9
+ <section id="cta" className="container mx-auto px-4 py-20">
10
10
  <div className="
11
11
  bg-gradient-to-r from-[#f7f8fa] via-[#e0c3fc] to-[#b2fefa]
12
12
  dark:bg-gradient-to-r dark:from-[#2d0b4e] dark:via-[#6a3fa0] dark:to-[#3a185a]
@@ -12,7 +12,7 @@ export function SeoContent() {
12
12
  const t = useTranslations('seoContent');
13
13
 
14
14
  return (
15
- <section className="container mx-auto px-4 py-20">
15
+ <section id="seo" className="container mx-auto px-4 py-20">
16
16
  <h2 className="text-3xl md:text-4xl font-bold text-center mb-16">
17
17
  {t('title')} <span className="text-purple-500">{t('eyesOn')}</span>
18
18
  </h2>