@coffic/cosy-ui 0.1.28 → 0.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/README.md +67 -23
- package/dist/app.css +1 -0
- package/dist/assets/logo-rounded.png +0 -0
- package/dist/assets/logo.png +0 -0
- package/dist/components/base/Alert.astro +186 -0
- package/dist/components/base/Button.astro +103 -0
- package/dist/components/base/Image.astro +291 -0
- package/dist/components/base/Link.astro +131 -0
- package/dist/components/base/README.md +53 -0
- package/dist/components/base/index.ts +6 -0
- package/dist/components/containers/Container.astro +103 -0
- package/dist/components/containers/Main.astro +167 -0
- package/dist/components/containers/Section.astro +145 -0
- package/dist/components/containers/index.ts +3 -0
- package/dist/components/data-display/Blog.astro +195 -0
- package/dist/components/data-display/README.md +37 -0
- package/dist/components/data-display/TeamMember.astro +135 -0
- package/dist/components/data-display/TeamMembers.astro +101 -0
- package/dist/components/data-display/index.ts +3 -0
- package/dist/components/display/Banner.astro +57 -0
- package/dist/components/display/Card.astro +135 -0
- package/dist/components/display/CodeBlock.astro +147 -0
- package/dist/components/display/CodeExample.astro +330 -0
- package/dist/components/display/Hero.astro +119 -0
- package/dist/components/display/Modal.astro +115 -0
- package/dist/components/display/README.md +32 -0
- package/dist/components/display/index.ts +6 -0
- package/dist/components/icons/AlertTriangle.astro +35 -0
- package/dist/components/icons/CalendarIcon.astro +38 -0
- package/dist/components/icons/CheckCircle.astro +36 -0
- package/dist/components/icons/CheckIcon.astro +38 -0
- package/dist/components/icons/ClipboardIcon.astro +39 -0
- package/dist/components/icons/CloseIcon.astro +38 -0
- package/dist/components/icons/ErrorIcon.astro +35 -0
- package/dist/components/icons/GithubIcon.astro +31 -0
- package/dist/components/icons/InfoCircle.astro +37 -0
- package/dist/components/icons/InfoIcon.astro +38 -0
- package/dist/components/icons/LinkIcon.astro +39 -0
- package/dist/components/icons/LinkedinIcon.astro +31 -0
- package/dist/components/icons/MenuIcon.astro +41 -0
- package/dist/components/icons/SearchIcon.astro +40 -0
- package/dist/components/icons/SocialIcon.astro +100 -0
- package/dist/components/icons/SuccessIcon.astro +35 -0
- package/dist/components/icons/SunCloudyIcon.astro +45 -0
- package/dist/components/icons/TwitterIcon.astro +31 -0
- package/dist/components/icons/UserIcon.astro +35 -0
- package/dist/components/icons/WarningIcon.astro +38 -0
- package/dist/components/icons/XCircle.astro +37 -0
- package/dist/components/icons/index.ts +23 -0
- package/dist/components/layouts/BaseLayout.astro +144 -0
- package/dist/components/layouts/DashboardLayout.astro +660 -0
- package/dist/components/layouts/DefaultLayout.astro +170 -0
- package/dist/components/layouts/DocumentationLayout.astro +469 -0
- package/dist/components/layouts/Flex.astro +138 -0
- package/dist/components/layouts/Footer.astro +284 -0
- package/dist/components/layouts/Grid.astro +182 -0
- package/dist/components/layouts/Header.astro +114 -0
- package/dist/components/layouts/LandingLayout.astro +388 -0
- package/dist/components/layouts/README.md +37 -0
- package/dist/components/layouts/Stack.astro +149 -0
- package/dist/components/layouts/index.ts +6 -0
- package/dist/components/navigation/LanguageSwitcher.astro +81 -0
- package/dist/components/navigation/README.md +24 -0
- package/dist/components/navigation/TableOfContents.astro +352 -0
- package/dist/components/navigation/ThemeSwitcher.astro +89 -0
- package/dist/components/navigation/index.ts +3 -0
- package/dist/components/typography/Article.astro +144 -0
- package/dist/components/typography/Heading.astro +205 -0
- package/dist/components/typography/README.md +29 -0
- package/dist/components/typography/Text.astro +187 -0
- package/dist/components/typography/index.ts +3 -0
- package/dist/index.ts +9 -0
- package/dist/integration.ts +14 -0
- package/dist/style.ts +1 -0
- package/{src → dist}/types/footer.ts +11 -7
- package/{src → dist}/utils/social.ts +5 -12
- package/dist/utils/theme.ts +55 -0
- package/package.json +65 -59
- package/index.ts +0 -18
- package/src/components/Alert.astro +0 -78
- package/src/components/Article.astro +0 -11
- package/src/components/Banner.astro +0 -49
- package/src/components/Blog.astro +0 -115
- package/src/components/Button.astro +0 -49
- package/src/components/Card.astro +0 -113
- package/src/components/CodeBlock.astro +0 -186
- package/src/components/Footer.astro +0 -130
- package/src/components/Header.astro +0 -305
- package/src/components/Hero.astro +0 -69
- package/src/components/Image.astro +0 -251
- package/src/components/Link.astro +0 -82
- package/src/components/Modal.astro +0 -67
- package/src/components/SocialIcon.astro +0 -36
- package/src/components/TeamMember.astro +0 -68
- package/src/components/TeamMembers.astro +0 -43
- package/src/env.d.ts +0 -0
- /package/{src/components → dist/components/base}/ThemeItem.astro +0 -0
package/package.json
CHANGED
@@ -1,60 +1,66 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
2
|
+
"name": "@coffic/cosy-ui",
|
3
|
+
"version": "0.2.0",
|
4
|
+
"description": "An astro component library",
|
5
|
+
"author": {
|
6
|
+
"name": "nookery",
|
7
|
+
"url": "https://github.com/nookery"
|
8
|
+
},
|
9
|
+
"license": "MIT",
|
10
|
+
"keywords": [
|
11
|
+
"astro-integration",
|
12
|
+
"astro-component",
|
13
|
+
"withastro",
|
14
|
+
"astro",
|
15
|
+
"cosy-ui"
|
16
|
+
],
|
17
|
+
"homepage": "https://github.con/CofficLab/cosy-ui",
|
18
|
+
"publishConfig": {
|
19
|
+
"access": "public"
|
20
|
+
},
|
21
|
+
"sideEffects": false,
|
22
|
+
"exports": {
|
23
|
+
".": "./dist/index.js"
|
24
|
+
},
|
25
|
+
"files": [
|
26
|
+
"dist"
|
27
|
+
],
|
28
|
+
"scripts": {
|
29
|
+
"dev": "astro dev",
|
30
|
+
"build": "vite build && tsx scripts/post-build.ts"
|
31
|
+
},
|
32
|
+
"type": "module",
|
33
|
+
"peerDependencies": {
|
34
|
+
"astro": "^5.1.3"
|
35
|
+
},
|
36
|
+
"dependencies": {
|
37
|
+
"astro-integration-kit": "^0.18.0",
|
38
|
+
"fs-extra": "^11.3.0"
|
39
|
+
},
|
40
|
+
"devDependencies": {
|
41
|
+
"@astrojs/check": "^0.9.4",
|
42
|
+
"@astrojs/ts-plugin": "^1.10.4",
|
43
|
+
"@tailwindcss/vite": "^4.0.14",
|
44
|
+
"@types/chai": "^5.2.0",
|
45
|
+
"@types/eslint": "^9.6.1",
|
46
|
+
"@types/fs-extra": "^11.0.4",
|
47
|
+
"@types/mocha": "^10.0.10",
|
48
|
+
"@types/node": "^22.13.10",
|
49
|
+
"@types/react": "^19.0.10",
|
50
|
+
"@typescript-eslint/parser": "^8.26.1",
|
51
|
+
"astro": "^5.5.2",
|
52
|
+
"chai": "^4.5.0",
|
53
|
+
"daisyui": "^5.0.4",
|
54
|
+
"eslint": "^8.57.1",
|
55
|
+
"eslint-plugin-astro": "^1.3.1",
|
56
|
+
"mocha": "^10.8.2",
|
57
|
+
"prettier": "^3.5.3",
|
58
|
+
"prettier-plugin-astro": "^0.14.1",
|
59
|
+
"rollup-plugin-copy": "^3.5.0",
|
60
|
+
"sharp": "^0.33.2",
|
61
|
+
"tailwindcss": "^4.0.14",
|
62
|
+
"tsx": "^4.19.3",
|
63
|
+
"typescript": "^5.8.2",
|
64
|
+
"vite": "^6.2.2"
|
65
|
+
}
|
66
|
+
}
|
package/index.ts
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
// 这里用于导出所有组件,注意按照字母排序
|
2
|
-
export { default as Alert } from './src/components/Alert.astro';
|
3
|
-
export { default as Article } from './src/components/Article.astro';
|
4
|
-
export { default as Blog } from './src/components/Blog.astro';
|
5
|
-
export { default as Banner } from './src/components/Banner.astro';
|
6
|
-
export { default as Button } from './src/components/Button.astro';
|
7
|
-
export { default as Card } from './src/components/Card.astro';
|
8
|
-
export { default as CodeBlock } from './src/components/CodeBlock.astro';
|
9
|
-
export { default as Footer } from './src/components/Footer.astro';
|
10
|
-
export { default as Header } from './src/components/Header.astro';
|
11
|
-
export { default as Hero } from './src/components/Hero.astro';
|
12
|
-
export { default as Image } from './src/components/Image.astro';
|
13
|
-
export { default as Link } from './src/components/Link.astro';
|
14
|
-
export { default as Modal } from './src/components/Modal.astro';
|
15
|
-
export { default as SocialIcon } from './src/components/SocialIcon.astro';
|
16
|
-
export { default as ThemeItem } from './src/components/ThemeItem.astro';
|
17
|
-
export { default as TeamMember } from './src/components/TeamMember.astro';
|
18
|
-
export { default as TeamMembers } from './src/components/TeamMembers.astro';
|
@@ -1,78 +0,0 @@
|
|
1
|
-
---
|
2
|
-
interface Props {
|
3
|
-
type?: 'info' | 'success' | 'warning' | 'error';
|
4
|
-
title?: string;
|
5
|
-
closeable?: boolean;
|
6
|
-
class?: string;
|
7
|
-
}
|
8
|
-
|
9
|
-
const {
|
10
|
-
type = 'info',
|
11
|
-
title,
|
12
|
-
closeable = false,
|
13
|
-
class: className = '',
|
14
|
-
} = Astro.props;
|
15
|
-
|
16
|
-
// 根据类型设置样式
|
17
|
-
const alertClass = {
|
18
|
-
info: 'alert-info',
|
19
|
-
success: 'alert-success',
|
20
|
-
warning: 'alert-warning',
|
21
|
-
error: 'alert-error',
|
22
|
-
}[type];
|
23
|
-
|
24
|
-
// 根据类型设置图标
|
25
|
-
const icons = {
|
26
|
-
info: `<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="h-6 w-6 stroke-current">
|
27
|
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
28
|
-
</svg>`,
|
29
|
-
success: `<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 stroke-current" fill="none" viewBox="0 0 24 24">
|
30
|
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
|
31
|
-
</svg>`,
|
32
|
-
warning: `<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 stroke-current" fill="none" viewBox="0 0 24 24">
|
33
|
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
|
34
|
-
</svg>`,
|
35
|
-
error: `<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 stroke-current" fill="none" viewBox="0 0 24 24">
|
36
|
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z" />
|
37
|
-
</svg>`,
|
38
|
-
};
|
39
|
-
---
|
40
|
-
|
41
|
-
<div class={`alert ${alertClass} ${className}`} role="alert">
|
42
|
-
<div class="flex items-center gap-2">
|
43
|
-
<div set:html={icons[type]} />
|
44
|
-
<div class="flex-1">
|
45
|
-
{title && <h3 class="font-bold">{title}</h3>}
|
46
|
-
<div><slot /></div>
|
47
|
-
</div>
|
48
|
-
{closeable && (
|
49
|
-
<button class="btn btn-ghost btn-sm btn-circle close-alert">
|
50
|
-
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
51
|
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
|
52
|
-
</svg>
|
53
|
-
</button>
|
54
|
-
)}
|
55
|
-
</div>
|
56
|
-
</div>
|
57
|
-
|
58
|
-
{closeable && (
|
59
|
-
<script>
|
60
|
-
function initializeCloseButtons() {
|
61
|
-
const closeButtons = document.querySelectorAll('.close-alert');
|
62
|
-
closeButtons.forEach(button => {
|
63
|
-
button.addEventListener('click', () => {
|
64
|
-
const alert = button.closest('.alert');
|
65
|
-
if (alert) {
|
66
|
-
alert.remove();
|
67
|
-
}
|
68
|
-
});
|
69
|
-
});
|
70
|
-
}
|
71
|
-
|
72
|
-
// 初始化关闭按钮
|
73
|
-
initializeCloseButtons();
|
74
|
-
|
75
|
-
// Astro 页面切换时重新初始化
|
76
|
-
document.addEventListener('astro:page-load', initializeCloseButtons);
|
77
|
-
</script>
|
78
|
-
)}
|
@@ -1,49 +0,0 @@
|
|
1
|
-
<div class="w-full max-w-7xl px-4 sm:px-8 z-50 mx-auto">
|
2
|
-
<div
|
3
|
-
class="mt-0 hero p-4 rounded-2xl bg-base-300/50 dark:bg-base-200/50 backdrop-blur-xl
|
4
|
-
hover:shadow-2xl transform duration-300 ease-in-out
|
5
|
-
hover:scale-[1.02] hover:bg-base-300/70 dark:hover:bg-base-200/70
|
6
|
-
motion-safe:animate-fadeIn"
|
7
|
-
>
|
8
|
-
<div class="text-center hero-content">
|
9
|
-
<div class="w-full max-w-prose flex flex-row justify-center items-center mx-auto">
|
10
|
-
<p
|
11
|
-
class="text-xl sm:text-2xl md:text-3xl font-bold text-base-content
|
12
|
-
motion-safe:animate-slideUp"
|
13
|
-
>
|
14
|
-
<slot />
|
15
|
-
</p>
|
16
|
-
</div>
|
17
|
-
</div>
|
18
|
-
</div>
|
19
|
-
</div>
|
20
|
-
|
21
|
-
<style>
|
22
|
-
@keyframes fadeIn {
|
23
|
-
from {
|
24
|
-
opacity: 0;
|
25
|
-
}
|
26
|
-
to {
|
27
|
-
opacity: 1;
|
28
|
-
}
|
29
|
-
}
|
30
|
-
|
31
|
-
@keyframes slideUp {
|
32
|
-
from {
|
33
|
-
opacity: 0;
|
34
|
-
transform: translateY(1rem);
|
35
|
-
}
|
36
|
-
to {
|
37
|
-
opacity: 1;
|
38
|
-
transform: translateY(0);
|
39
|
-
}
|
40
|
-
}
|
41
|
-
|
42
|
-
.animate-fadeIn {
|
43
|
-
animation: fadeIn 0.5s ease-out;
|
44
|
-
}
|
45
|
-
|
46
|
-
.animate-slideUp {
|
47
|
-
animation: slideUp 0.5s ease-out;
|
48
|
-
}
|
49
|
-
</style>
|
@@ -1,115 +0,0 @@
|
|
1
|
-
---
|
2
|
-
interface Props {
|
3
|
-
title: string;
|
4
|
-
subtitle?: string;
|
5
|
-
author?: string;
|
6
|
-
date?: Date;
|
7
|
-
cover?: {
|
8
|
-
src: string;
|
9
|
-
alt?: string;
|
10
|
-
};
|
11
|
-
tags?: string[];
|
12
|
-
}
|
13
|
-
|
14
|
-
const {
|
15
|
-
title,
|
16
|
-
subtitle,
|
17
|
-
author,
|
18
|
-
date,
|
19
|
-
cover,
|
20
|
-
tags = [],
|
21
|
-
} = Astro.props;
|
22
|
-
|
23
|
-
// 格式化日期
|
24
|
-
const formatDate = (date?: Date) => {
|
25
|
-
if (!date) return '';
|
26
|
-
return new Intl.DateTimeFormat('zh-CN', {
|
27
|
-
year: 'numeric',
|
28
|
-
month: 'long',
|
29
|
-
day: 'numeric'
|
30
|
-
}).format(date);
|
31
|
-
};
|
32
|
-
---
|
33
|
-
|
34
|
-
<article class="article">
|
35
|
-
{/* 文章头部 */}
|
36
|
-
<header class="mb-8">
|
37
|
-
{cover && (
|
38
|
-
<div class="relative w-full h-[300px] md:h-[400px] mb-6 rounded-lg overflow-hidden">
|
39
|
-
<img
|
40
|
-
src={cover.src}
|
41
|
-
alt={cover.alt || title}
|
42
|
-
class="w-full h-full object-cover"
|
43
|
-
/>
|
44
|
-
</div>
|
45
|
-
)}
|
46
|
-
|
47
|
-
<div class="space-y-4">
|
48
|
-
<h1 class="text-4xl md:text-5xl font-bold tracking-tight">{title}</h1>
|
49
|
-
{subtitle && (
|
50
|
-
<p class="text-xl text-base-content/70">{subtitle}</p>
|
51
|
-
)}
|
52
|
-
|
53
|
-
<div class="flex flex-wrap items-center gap-4 text-sm text-base-content/60">
|
54
|
-
{author && (
|
55
|
-
<div class="flex items-center gap-2">
|
56
|
-
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" viewBox="0 0 24 24" fill="none" stroke="currentColor">
|
57
|
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" />
|
58
|
-
</svg>
|
59
|
-
<span>{author}</span>
|
60
|
-
</div>
|
61
|
-
)}
|
62
|
-
|
63
|
-
{date && (
|
64
|
-
<div class="flex items-center gap-2">
|
65
|
-
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" viewBox="0 0 24 24" fill="none" stroke="currentColor">
|
66
|
-
<rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect>
|
67
|
-
<line x1="16" y1="2" x2="16" y2="6"></line>
|
68
|
-
<line x1="8" y1="2" x2="8" y2="6"></line>
|
69
|
-
<line x1="3" y1="10" x2="21" y2="10"></line>
|
70
|
-
</svg>
|
71
|
-
<time datetime={date.toISOString()}>{formatDate(date)}</time>
|
72
|
-
</div>
|
73
|
-
)}
|
74
|
-
</div>
|
75
|
-
|
76
|
-
{tags.length > 0 && (
|
77
|
-
<div class="flex flex-wrap gap-2">
|
78
|
-
{tags.map(tag => (
|
79
|
-
<span class="badge badge-outline">{tag}</span>
|
80
|
-
))}
|
81
|
-
</div>
|
82
|
-
)}
|
83
|
-
</div>
|
84
|
-
</header>
|
85
|
-
|
86
|
-
{/* 文章内容 */}
|
87
|
-
<div class="prose prose-lg max-w-none">
|
88
|
-
<slot />
|
89
|
-
</div>
|
90
|
-
</article>
|
91
|
-
|
92
|
-
<style>
|
93
|
-
/* 自定义文章样式 */
|
94
|
-
.article {
|
95
|
-
container-type: inline-size;
|
96
|
-
}
|
97
|
-
|
98
|
-
/* 优化大屏幕阅读体验 */
|
99
|
-
@container (min-width: 768px) {
|
100
|
-
.article {
|
101
|
-
font-size: 1.125rem;
|
102
|
-
line-height: 1.75;
|
103
|
-
}
|
104
|
-
}
|
105
|
-
|
106
|
-
/* 暗色主题适配 */
|
107
|
-
:global([data-theme="dark"]) .article {
|
108
|
-
--tw-prose-body: hsl(var(--bc));
|
109
|
-
--tw-prose-headings: hsl(var(--bc));
|
110
|
-
--tw-prose-links: hsl(var(--p));
|
111
|
-
--tw-prose-bold: hsl(var(--bc));
|
112
|
-
--tw-prose-quotes: hsl(var(--bc));
|
113
|
-
--tw-prose-code: hsl(var(--bc));
|
114
|
-
}
|
115
|
-
</style>
|
@@ -1,49 +0,0 @@
|
|
1
|
-
---
|
2
|
-
interface Props {
|
3
|
-
variant?: 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error' | 'ghost' | 'link' | 'outline' | 'neutral';
|
4
|
-
size?: 'lg' | 'md' | 'sm' | 'xs';
|
5
|
-
shape?: 'circle' | 'square';
|
6
|
-
wide?: boolean;
|
7
|
-
block?: boolean;
|
8
|
-
loading?: boolean;
|
9
|
-
disabled?: boolean;
|
10
|
-
type?: 'button' | 'submit' | 'reset';
|
11
|
-
class?: string;
|
12
|
-
onClick?: string;
|
13
|
-
}
|
14
|
-
|
15
|
-
const {
|
16
|
-
variant,
|
17
|
-
size,
|
18
|
-
shape,
|
19
|
-
wide = false,
|
20
|
-
block = false,
|
21
|
-
loading = false,
|
22
|
-
disabled = false,
|
23
|
-
type = 'button',
|
24
|
-
class: className,
|
25
|
-
onClick,
|
26
|
-
} = Astro.props;
|
27
|
-
|
28
|
-
const classes = [
|
29
|
-
'btn',
|
30
|
-
variant && `btn-${variant}`,
|
31
|
-
size && `btn-${size}`,
|
32
|
-
shape && `btn-${shape}`,
|
33
|
-
wide && 'btn-wide',
|
34
|
-
block && 'btn-block',
|
35
|
-
loading && 'loading',
|
36
|
-
className,
|
37
|
-
].filter(Boolean).join(' ');
|
38
|
-
---
|
39
|
-
|
40
|
-
<button
|
41
|
-
type={type}
|
42
|
-
class={classes}
|
43
|
-
disabled={disabled}
|
44
|
-
onclick={onClick}
|
45
|
-
>
|
46
|
-
<slot name="icon-left" />
|
47
|
-
<slot />
|
48
|
-
<slot name="icon-right" />
|
49
|
-
</button>
|
@@ -1,113 +0,0 @@
|
|
1
|
-
---
|
2
|
-
interface Props {
|
3
|
-
title?: string;
|
4
|
-
subtitle?: string;
|
5
|
-
imageUrl?: string;
|
6
|
-
href?: string;
|
7
|
-
}
|
8
|
-
|
9
|
-
const { title, subtitle, imageUrl, href } = Astro.props;
|
10
|
-
---
|
11
|
-
|
12
|
-
<div class="group perspective-1000">
|
13
|
-
<div class:list={[
|
14
|
-
"card w-full bg-base-100/60 dark:bg-base-300/60 backdrop-blur-lg",
|
15
|
-
"transform transition-all duration-300 ease-out",
|
16
|
-
"hover:shadow-2xl hover:scale-[1.02]",
|
17
|
-
"active:scale-[0.98]",
|
18
|
-
"motion-safe:animate-fadeIn",
|
19
|
-
href && "cursor-pointer"
|
20
|
-
]}>
|
21
|
-
{href ? (
|
22
|
-
<a href={href} class="card-body group-hover:translate-y-[-2px] transition-transform duration-300">
|
23
|
-
{imageUrl && (
|
24
|
-
<figure class="relative overflow-hidden rounded-t-2xl">
|
25
|
-
<img
|
26
|
-
src={imageUrl}
|
27
|
-
alt={title}
|
28
|
-
class="w-full h-48 object-cover transform transition-transform duration-300 group-hover:scale-105"
|
29
|
-
/>
|
30
|
-
</figure>
|
31
|
-
)}
|
32
|
-
{title && (
|
33
|
-
<h2 class="card-title text-xl font-bold tracking-tight text-base-content">
|
34
|
-
{title}
|
35
|
-
</h2>
|
36
|
-
)}
|
37
|
-
{subtitle && (
|
38
|
-
<p class="text-base-content/80">
|
39
|
-
{subtitle}
|
40
|
-
</p>
|
41
|
-
)}
|
42
|
-
<slot />
|
43
|
-
</a>
|
44
|
-
) : (
|
45
|
-
<div class="card-body">
|
46
|
-
{imageUrl && (
|
47
|
-
<figure class="relative overflow-hidden rounded-t-2xl">
|
48
|
-
<img
|
49
|
-
src={imageUrl}
|
50
|
-
alt={title}
|
51
|
-
class="w-full h-48 object-cover transform transition-transform duration-300 group-hover:scale-105"
|
52
|
-
/>
|
53
|
-
</figure>
|
54
|
-
)}
|
55
|
-
{title && (
|
56
|
-
<h2 class="card-title text-xl font-bold tracking-tight text-base-content">
|
57
|
-
{title}
|
58
|
-
</h2>
|
59
|
-
)}
|
60
|
-
{subtitle && (
|
61
|
-
<p class="text-base-content/80">
|
62
|
-
{subtitle}
|
63
|
-
</p>
|
64
|
-
)}
|
65
|
-
<slot />
|
66
|
-
</div>
|
67
|
-
)}
|
68
|
-
</div>
|
69
|
-
</div>
|
70
|
-
|
71
|
-
<style>
|
72
|
-
@keyframes fadeIn {
|
73
|
-
from {
|
74
|
-
opacity: 0;
|
75
|
-
transform: translateY(10px);
|
76
|
-
}
|
77
|
-
to {
|
78
|
-
opacity: 1;
|
79
|
-
transform: translateY(0);
|
80
|
-
}
|
81
|
-
}
|
82
|
-
|
83
|
-
.animate-fadeIn {
|
84
|
-
animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
|
85
|
-
}
|
86
|
-
|
87
|
-
.perspective-1000 {
|
88
|
-
perspective: 1000px;
|
89
|
-
}
|
90
|
-
|
91
|
-
.card {
|
92
|
-
position: relative;
|
93
|
-
border: 1px solid rgba(255, 255, 255, 0.1);
|
94
|
-
}
|
95
|
-
|
96
|
-
.card::before {
|
97
|
-
content: '';
|
98
|
-
position: absolute;
|
99
|
-
inset: 0;
|
100
|
-
z-index: -1;
|
101
|
-
background: radial-gradient(
|
102
|
-
circle at 50% 0%,
|
103
|
-
rgba(255, 255, 255, 0.1),
|
104
|
-
transparent 70%
|
105
|
-
);
|
106
|
-
opacity: 0;
|
107
|
-
transition: opacity 0.3s ease;
|
108
|
-
}
|
109
|
-
|
110
|
-
.card:hover::before {
|
111
|
-
opacity: 1;
|
112
|
-
}
|
113
|
-
</style>
|