@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
@@ -0,0 +1,36 @@
|
|
1
|
+
---
|
2
|
+
interface Props {
|
3
|
+
/**
|
4
|
+
* 图标的大小
|
5
|
+
* @default "24px"
|
6
|
+
*/
|
7
|
+
size?: string;
|
8
|
+
/**
|
9
|
+
* 图标的颜色
|
10
|
+
* @default "currentColor"
|
11
|
+
*/
|
12
|
+
color?: string;
|
13
|
+
/**
|
14
|
+
* 自定义类名
|
15
|
+
*/
|
16
|
+
class?: string;
|
17
|
+
}
|
18
|
+
|
19
|
+
const { size = '24px', color = 'currentColor', class: className = '' } = Astro.props;
|
20
|
+
---
|
21
|
+
|
22
|
+
<svg
|
23
|
+
xmlns="http://www.w3.org/2000/svg"
|
24
|
+
width={size}
|
25
|
+
height={size}
|
26
|
+
viewBox="0 0 24 24"
|
27
|
+
fill="none"
|
28
|
+
stroke={color}
|
29
|
+
stroke-width="2"
|
30
|
+
stroke-linecap="round"
|
31
|
+
stroke-linejoin="round"
|
32
|
+
class={className}
|
33
|
+
>
|
34
|
+
<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path>
|
35
|
+
<polyline points="22 4 12 14.01 9 11.01"></polyline>
|
36
|
+
</svg>
|
@@ -0,0 +1,38 @@
|
|
1
|
+
---
|
2
|
+
/**
|
3
|
+
* 检查图标组件
|
4
|
+
*/
|
5
|
+
interface Props {
|
6
|
+
/**
|
7
|
+
* 图标的大小
|
8
|
+
* @default "24px"
|
9
|
+
*/
|
10
|
+
size?: string;
|
11
|
+
/**
|
12
|
+
* 图标的颜色
|
13
|
+
* @default "currentColor"
|
14
|
+
*/
|
15
|
+
color?: string;
|
16
|
+
/**
|
17
|
+
* 自定义类名
|
18
|
+
*/
|
19
|
+
class?: string;
|
20
|
+
}
|
21
|
+
|
22
|
+
const { size = '24px', color = 'currentColor', class: className = '' } = Astro.props;
|
23
|
+
---
|
24
|
+
|
25
|
+
<svg
|
26
|
+
xmlns="http://www.w3.org/2000/svg"
|
27
|
+
width={size}
|
28
|
+
height={size}
|
29
|
+
viewBox="0 0 24 24"
|
30
|
+
fill="none"
|
31
|
+
stroke={color}
|
32
|
+
stroke-width="2"
|
33
|
+
stroke-linecap="round"
|
34
|
+
stroke-linejoin="round"
|
35
|
+
class={className}
|
36
|
+
>
|
37
|
+
<polyline points="20 6 9 17 4 12"></polyline>
|
38
|
+
</svg>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
---
|
2
|
+
/**
|
3
|
+
* 剪贴板图标组件
|
4
|
+
*/
|
5
|
+
interface Props {
|
6
|
+
/**
|
7
|
+
* 图标的大小
|
8
|
+
* @default "24px"
|
9
|
+
*/
|
10
|
+
size?: string;
|
11
|
+
/**
|
12
|
+
* 图标的颜色
|
13
|
+
* @default "currentColor"
|
14
|
+
*/
|
15
|
+
color?: string;
|
16
|
+
/**
|
17
|
+
* 自定义类名
|
18
|
+
*/
|
19
|
+
class?: string;
|
20
|
+
}
|
21
|
+
|
22
|
+
const { size = '24px', color = 'currentColor', class: className = '' } = Astro.props;
|
23
|
+
---
|
24
|
+
|
25
|
+
<svg
|
26
|
+
xmlns="http://www.w3.org/2000/svg"
|
27
|
+
width={size}
|
28
|
+
height={size}
|
29
|
+
viewBox="0 0 24 24"
|
30
|
+
fill="none"
|
31
|
+
stroke={color}
|
32
|
+
stroke-width="2"
|
33
|
+
stroke-linecap="round"
|
34
|
+
stroke-linejoin="round"
|
35
|
+
class={className}
|
36
|
+
>
|
37
|
+
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
|
38
|
+
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
|
39
|
+
</svg>
|
@@ -0,0 +1,38 @@
|
|
1
|
+
---
|
2
|
+
/**
|
3
|
+
* 关闭图标组件
|
4
|
+
*/
|
5
|
+
interface Props {
|
6
|
+
/**
|
7
|
+
* 图标的大小
|
8
|
+
* @default "16px"
|
9
|
+
*/
|
10
|
+
size?: string;
|
11
|
+
/**
|
12
|
+
* 图标的颜色
|
13
|
+
* @default "currentColor"
|
14
|
+
*/
|
15
|
+
color?: string;
|
16
|
+
/**
|
17
|
+
* 自定义类名
|
18
|
+
*/
|
19
|
+
class?: string;
|
20
|
+
}
|
21
|
+
|
22
|
+
const { size = '16px', color = 'currentColor', class: className = '' } = Astro.props;
|
23
|
+
---
|
24
|
+
|
25
|
+
<svg
|
26
|
+
xmlns="http://www.w3.org/2000/svg"
|
27
|
+
width={size}
|
28
|
+
height={size}
|
29
|
+
viewBox="0 0 24 24"
|
30
|
+
fill="none"
|
31
|
+
stroke={color}
|
32
|
+
stroke-width="2"
|
33
|
+
stroke-linecap="round"
|
34
|
+
stroke-linejoin="round"
|
35
|
+
class={className}
|
36
|
+
>
|
37
|
+
<path d="M6 18L18 6M6 6l12 12" />
|
38
|
+
</svg>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
---
|
2
|
+
interface Props {
|
3
|
+
/**
|
4
|
+
* 图标的大小
|
5
|
+
* @default "24px"
|
6
|
+
*/
|
7
|
+
size?: string;
|
8
|
+
/**
|
9
|
+
* 图标的颜色
|
10
|
+
* @default "currentColor"
|
11
|
+
*/
|
12
|
+
color?: string;
|
13
|
+
/**
|
14
|
+
* 自定义类名
|
15
|
+
*/
|
16
|
+
class?: string;
|
17
|
+
}
|
18
|
+
|
19
|
+
const { size = '24px', color = 'currentColor', class: className = '' } = Astro.props;
|
20
|
+
---
|
21
|
+
|
22
|
+
<svg
|
23
|
+
xmlns="http://www.w3.org/2000/svg"
|
24
|
+
width={size}
|
25
|
+
height={size}
|
26
|
+
viewBox="0 0 24 24"
|
27
|
+
fill="none"
|
28
|
+
stroke={color}
|
29
|
+
stroke-width="2"
|
30
|
+
stroke-linecap="round"
|
31
|
+
stroke-linejoin="round"
|
32
|
+
class={className}
|
33
|
+
>
|
34
|
+
<path d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z" />
|
35
|
+
</svg>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
---
|
2
|
+
interface Props {
|
3
|
+
/**
|
4
|
+
* 图标的大小
|
5
|
+
* @default "24px"
|
6
|
+
*/
|
7
|
+
size?: string;
|
8
|
+
/**
|
9
|
+
* 图标的颜色
|
10
|
+
* @default "currentColor"
|
11
|
+
*/
|
12
|
+
color?: string;
|
13
|
+
/**
|
14
|
+
* 自定义类名
|
15
|
+
*/
|
16
|
+
class?: string;
|
17
|
+
}
|
18
|
+
|
19
|
+
const { size = '24px', color = 'currentColor', class: className = '' } = Astro.props;
|
20
|
+
---
|
21
|
+
|
22
|
+
<svg
|
23
|
+
xmlns="http://www.w3.org/2000/svg"
|
24
|
+
width={size}
|
25
|
+
height={size}
|
26
|
+
viewBox="0 0 24 24"
|
27
|
+
fill={color}
|
28
|
+
class={className}
|
29
|
+
>
|
30
|
+
<path d="M12 0C5.374 0 0 5.373 0 12c0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23A11.509 11.509 0 0112 5.803c1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576C20.566 21.797 24 17.3 24 12c0-6.627-5.373-12-12-12z" />
|
31
|
+
</svg>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
---
|
2
|
+
interface Props {
|
3
|
+
/**
|
4
|
+
* 图标的大小
|
5
|
+
* @default "24px"
|
6
|
+
*/
|
7
|
+
size?: string;
|
8
|
+
/**
|
9
|
+
* 图标的颜色
|
10
|
+
* @default "currentColor"
|
11
|
+
*/
|
12
|
+
color?: string;
|
13
|
+
/**
|
14
|
+
* 自定义类名
|
15
|
+
*/
|
16
|
+
class?: string;
|
17
|
+
}
|
18
|
+
|
19
|
+
const { size = '24px', color = 'currentColor', class: className = '' } = Astro.props;
|
20
|
+
---
|
21
|
+
|
22
|
+
<svg
|
23
|
+
xmlns="http://www.w3.org/2000/svg"
|
24
|
+
width={size}
|
25
|
+
height={size}
|
26
|
+
viewBox="0 0 24 24"
|
27
|
+
fill="none"
|
28
|
+
stroke={color}
|
29
|
+
stroke-width="2"
|
30
|
+
stroke-linecap="round"
|
31
|
+
stroke-linejoin="round"
|
32
|
+
class={className}
|
33
|
+
>
|
34
|
+
<circle cx="12" cy="12" r="10"></circle>
|
35
|
+
<line x1="12" y1="16" x2="12" y2="12"></line>
|
36
|
+
<line x1="12" y1="8" x2="12.01" y2="8"></line>
|
37
|
+
</svg>
|
@@ -0,0 +1,38 @@
|
|
1
|
+
---
|
2
|
+
/**
|
3
|
+
* 信息图标组件
|
4
|
+
*/
|
5
|
+
interface Props {
|
6
|
+
/**
|
7
|
+
* 图标的大小
|
8
|
+
* @default "24px"
|
9
|
+
*/
|
10
|
+
size?: string;
|
11
|
+
/**
|
12
|
+
* 图标的颜色
|
13
|
+
* @default "currentColor"
|
14
|
+
*/
|
15
|
+
color?: string;
|
16
|
+
/**
|
17
|
+
* 自定义类名
|
18
|
+
*/
|
19
|
+
class?: string;
|
20
|
+
}
|
21
|
+
|
22
|
+
const { size = '24px', color = 'currentColor', class: className = '' } = Astro.props;
|
23
|
+
---
|
24
|
+
|
25
|
+
<svg
|
26
|
+
xmlns="http://www.w3.org/2000/svg"
|
27
|
+
width={size}
|
28
|
+
height={size}
|
29
|
+
viewBox="0 0 24 24"
|
30
|
+
fill="none"
|
31
|
+
stroke={color}
|
32
|
+
stroke-width="2"
|
33
|
+
stroke-linecap="round"
|
34
|
+
stroke-linejoin="round"
|
35
|
+
class={className}
|
36
|
+
>
|
37
|
+
<path d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
|
38
|
+
</svg>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
---
|
2
|
+
/**
|
3
|
+
* 链接图标组件
|
4
|
+
*/
|
5
|
+
interface Props {
|
6
|
+
/**
|
7
|
+
* 图标的大小
|
8
|
+
* @default "24px"
|
9
|
+
*/
|
10
|
+
size?: string;
|
11
|
+
/**
|
12
|
+
* 图标的颜色
|
13
|
+
* @default "currentColor"
|
14
|
+
*/
|
15
|
+
color?: string;
|
16
|
+
/**
|
17
|
+
* 自定义类名
|
18
|
+
*/
|
19
|
+
class?: string;
|
20
|
+
}
|
21
|
+
|
22
|
+
const { size = '24px', color = 'currentColor', class: className = '' } = Astro.props;
|
23
|
+
---
|
24
|
+
|
25
|
+
<svg
|
26
|
+
xmlns="http://www.w3.org/2000/svg"
|
27
|
+
width={size}
|
28
|
+
height={size}
|
29
|
+
viewBox="0 0 24 24"
|
30
|
+
fill="none"
|
31
|
+
stroke={color}
|
32
|
+
stroke-width="2"
|
33
|
+
stroke-linecap="round"
|
34
|
+
stroke-linejoin="round"
|
35
|
+
class={className}
|
36
|
+
>
|
37
|
+
<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path>
|
38
|
+
<path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path>
|
39
|
+
</svg>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
---
|
2
|
+
interface Props {
|
3
|
+
/**
|
4
|
+
* 图标的大小
|
5
|
+
* @default "24px"
|
6
|
+
*/
|
7
|
+
size?: string;
|
8
|
+
/**
|
9
|
+
* 图标的颜色
|
10
|
+
* @default "currentColor"
|
11
|
+
*/
|
12
|
+
color?: string;
|
13
|
+
/**
|
14
|
+
* 自定义类名
|
15
|
+
*/
|
16
|
+
class?: string;
|
17
|
+
}
|
18
|
+
|
19
|
+
const { size = '24px', color = 'currentColor', class: className = '' } = Astro.props;
|
20
|
+
---
|
21
|
+
|
22
|
+
<svg
|
23
|
+
xmlns="http://www.w3.org/2000/svg"
|
24
|
+
width={size}
|
25
|
+
height={size}
|
26
|
+
viewBox="0 0 24 24"
|
27
|
+
fill={color}
|
28
|
+
class={className}
|
29
|
+
>
|
30
|
+
<path d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z" />
|
31
|
+
</svg>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
---
|
2
|
+
interface Props {
|
3
|
+
/**
|
4
|
+
* 图标的大小
|
5
|
+
* @default "24px"
|
6
|
+
*/
|
7
|
+
size?: string;
|
8
|
+
/**
|
9
|
+
* 图标的颜色
|
10
|
+
* @default "currentColor"
|
11
|
+
*/
|
12
|
+
color?: string;
|
13
|
+
/**
|
14
|
+
* 自定义类名
|
15
|
+
*/
|
16
|
+
class?: string;
|
17
|
+
/**
|
18
|
+
* 插槽名称
|
19
|
+
*/
|
20
|
+
slot?: string;
|
21
|
+
}
|
22
|
+
|
23
|
+
const { size = '24px', color = 'currentColor', class: className = '', slot } = Astro.props;
|
24
|
+
---
|
25
|
+
|
26
|
+
<svg
|
27
|
+
xmlns="http://www.w3.org/2000/svg"
|
28
|
+
width={size}
|
29
|
+
height={size}
|
30
|
+
viewBox="0 0 24 24"
|
31
|
+
fill="none"
|
32
|
+
stroke={color}
|
33
|
+
stroke-width="2"
|
34
|
+
stroke-linecap="round"
|
35
|
+
stroke-linejoin="round"
|
36
|
+
class={className}
|
37
|
+
>
|
38
|
+
<line x1="3" y1="12" x2="21" y2="12" />
|
39
|
+
<line x1="3" y1="6" x2="21" y2="6" />
|
40
|
+
<line x1="3" y1="18" x2="21" y2="18" />
|
41
|
+
</svg>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
---
|
2
|
+
interface Props {
|
3
|
+
/**
|
4
|
+
* 图标的大小
|
5
|
+
* @default "24px"
|
6
|
+
*/
|
7
|
+
size?: string;
|
8
|
+
/**
|
9
|
+
* 图标的颜色
|
10
|
+
* @default "currentColor"
|
11
|
+
*/
|
12
|
+
color?: string;
|
13
|
+
/**
|
14
|
+
* 自定义类名
|
15
|
+
*/
|
16
|
+
class?: string;
|
17
|
+
/**
|
18
|
+
* 插槽名称
|
19
|
+
*/
|
20
|
+
slot?: string;
|
21
|
+
}
|
22
|
+
|
23
|
+
const { size = '24px', color = 'currentColor', class: className = '', slot } = Astro.props;
|
24
|
+
---
|
25
|
+
|
26
|
+
<svg
|
27
|
+
xmlns="http://www.w3.org/2000/svg"
|
28
|
+
width={size}
|
29
|
+
height={size}
|
30
|
+
viewBox="0 0 24 24"
|
31
|
+
fill="none"
|
32
|
+
stroke={color}
|
33
|
+
stroke-width="2"
|
34
|
+
stroke-linecap="round"
|
35
|
+
stroke-linejoin="round"
|
36
|
+
class={className}
|
37
|
+
>
|
38
|
+
<circle cx="11" cy="11" r="8" />
|
39
|
+
<line x1="21" y1="21" x2="16.65" y2="16.65" />
|
40
|
+
</svg>
|
@@ -0,0 +1,100 @@
|
|
1
|
+
---
|
2
|
+
/**
|
3
|
+
* @component SocialIcon
|
4
|
+
*
|
5
|
+
* @description
|
6
|
+
* SocialIcon 组件用于显示社交媒体平台的图标,支持多种常见的社交媒体平台。
|
7
|
+
* 它提供了一致的样式和交互效果,同时支持自定义大小和颜色。
|
8
|
+
*
|
9
|
+
* @design
|
10
|
+
* 设计理念:
|
11
|
+
* 1. 简洁明了 - 使用清晰易识别的图标表示社交媒体平台
|
12
|
+
* 2. 一致性 - 保持统一的样式和交互效果
|
13
|
+
* 3. 可定制性 - 支持自定义大小、颜色和样式
|
14
|
+
* 4. 可访问性 - 提供适当的 aria 标签,确保屏幕阅读器可以识别
|
15
|
+
*
|
16
|
+
* @usage
|
17
|
+
* 基本用法:
|
18
|
+
* ```astro
|
19
|
+
* <SocialIcon platform="github" />
|
20
|
+
* <SocialIcon platform="twitter" />
|
21
|
+
* <SocialIcon platform="linkedin" />
|
22
|
+
* ```
|
23
|
+
*
|
24
|
+
* 自定义大小和颜色:
|
25
|
+
* ```astro
|
26
|
+
* <SocialIcon platform="github" size="32px" color="#333" />
|
27
|
+
* ```
|
28
|
+
*
|
29
|
+
* 使用自定义类名:
|
30
|
+
* ```astro
|
31
|
+
* <SocialIcon platform="twitter" class="my-custom-class" />
|
32
|
+
* ```
|
33
|
+
*/
|
34
|
+
|
35
|
+
// 导入样式
|
36
|
+
import '../../app.css';
|
37
|
+
|
38
|
+
import GithubIcon from './GithubIcon.astro';
|
39
|
+
import TwitterIcon from './TwitterIcon.astro';
|
40
|
+
import LinkedinIcon from './LinkedinIcon.astro';
|
41
|
+
|
42
|
+
interface Props {
|
43
|
+
/**
|
44
|
+
* 社交媒体平台名称
|
45
|
+
* @default "default"
|
46
|
+
*/
|
47
|
+
platform: string;
|
48
|
+
|
49
|
+
/**
|
50
|
+
* 图标的大小
|
51
|
+
* @default "24px"
|
52
|
+
*/
|
53
|
+
size?: string;
|
54
|
+
|
55
|
+
/**
|
56
|
+
* 图标的颜色
|
57
|
+
* @default "currentColor"
|
58
|
+
*/
|
59
|
+
color?: string;
|
60
|
+
|
61
|
+
/**
|
62
|
+
* 自定义类名
|
63
|
+
*/
|
64
|
+
class?: string;
|
65
|
+
}
|
66
|
+
|
67
|
+
const {
|
68
|
+
platform = 'default',
|
69
|
+
size = '24px',
|
70
|
+
color = 'currentColor',
|
71
|
+
class: className = ''
|
72
|
+
} = Astro.props;
|
73
|
+
|
74
|
+
// 获取平台名称的首字母大写版本,用于显示
|
75
|
+
const platformName = platform.charAt(0).toUpperCase() + platform.slice(1);
|
76
|
+
|
77
|
+
// 根据平台名称选择对应的图标组件
|
78
|
+
const getIconComponent = (platform: string) => {
|
79
|
+
switch (platform.toLowerCase()) {
|
80
|
+
case 'github':
|
81
|
+
return GithubIcon;
|
82
|
+
case 'twitter':
|
83
|
+
return TwitterIcon;
|
84
|
+
case 'linkedin':
|
85
|
+
return LinkedinIcon;
|
86
|
+
// 其他平台图标可以在这里添加
|
87
|
+
default:
|
88
|
+
return GithubIcon; // 默认使用 GitHub 图标
|
89
|
+
}
|
90
|
+
};
|
91
|
+
|
92
|
+
const IconComponent = getIconComponent(platform);
|
93
|
+
|
94
|
+
// 构建社交图标的类名
|
95
|
+
const socialIconClass = `social-icon social-icon-${platform.toLowerCase()} ${className}`;
|
96
|
+
---
|
97
|
+
|
98
|
+
<div class={socialIconClass} aria-label={`${platformName} 图标`}>
|
99
|
+
<IconComponent size={size} color={color} />
|
100
|
+
</div>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
---
|
2
|
+
interface Props {
|
3
|
+
/**
|
4
|
+
* 图标的大小
|
5
|
+
* @default "24px"
|
6
|
+
*/
|
7
|
+
size?: string;
|
8
|
+
/**
|
9
|
+
* 图标的颜色
|
10
|
+
* @default "currentColor"
|
11
|
+
*/
|
12
|
+
color?: string;
|
13
|
+
/**
|
14
|
+
* 自定义类名
|
15
|
+
*/
|
16
|
+
class?: string;
|
17
|
+
}
|
18
|
+
|
19
|
+
const { size = '24px', color = 'currentColor', class: className = '' } = Astro.props;
|
20
|
+
---
|
21
|
+
|
22
|
+
<svg
|
23
|
+
xmlns="http://www.w3.org/2000/svg"
|
24
|
+
width={size}
|
25
|
+
height={size}
|
26
|
+
viewBox="0 0 24 24"
|
27
|
+
fill="none"
|
28
|
+
stroke={color}
|
29
|
+
stroke-width="2"
|
30
|
+
stroke-linecap="round"
|
31
|
+
stroke-linejoin="round"
|
32
|
+
class={className}
|
33
|
+
>
|
34
|
+
<path d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
|
35
|
+
</svg>
|
@@ -0,0 +1,45 @@
|
|
1
|
+
---
|
2
|
+
interface Props {
|
3
|
+
/**
|
4
|
+
* 图标的大小
|
5
|
+
* @default "24px"
|
6
|
+
*/
|
7
|
+
size?: string;
|
8
|
+
/**
|
9
|
+
* 图标的颜色
|
10
|
+
* @default "currentColor"
|
11
|
+
*/
|
12
|
+
color?: string;
|
13
|
+
/**
|
14
|
+
* 自定义类名
|
15
|
+
*/
|
16
|
+
class?: string;
|
17
|
+
/**
|
18
|
+
* 插槽名称
|
19
|
+
*/
|
20
|
+
slot?: string;
|
21
|
+
}
|
22
|
+
|
23
|
+
const { size = '24px', color = 'currentColor', class: className = '', slot } = Astro.props;
|
24
|
+
---
|
25
|
+
|
26
|
+
<svg
|
27
|
+
xmlns="http://www.w3.org/2000/svg"
|
28
|
+
width={size}
|
29
|
+
height={size}
|
30
|
+
viewBox="0 0 24 24"
|
31
|
+
fill="none"
|
32
|
+
stroke={color}
|
33
|
+
stroke-width="2"
|
34
|
+
stroke-linecap="round"
|
35
|
+
stroke-linejoin="round"
|
36
|
+
class={className}
|
37
|
+
>
|
38
|
+
<path d="M12 2v2" />
|
39
|
+
<path d="M2 12h2" />
|
40
|
+
<path d="M20 12h2" />
|
41
|
+
<path d="M4.93 4.93l1.41 1.41" />
|
42
|
+
<path d="M17.66 4.93l-1.41 1.41" />
|
43
|
+
<path d="M12 19a4 4 0 100-8 4 4 0 000 8z" />
|
44
|
+
<path d="M12 15a7 7 0 00-7 7h14a7 7 0 00-7-7z" />
|
45
|
+
</svg>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
---
|
2
|
+
interface Props {
|
3
|
+
/**
|
4
|
+
* 图标的大小
|
5
|
+
* @default "24px"
|
6
|
+
*/
|
7
|
+
size?: string;
|
8
|
+
/**
|
9
|
+
* 图标的颜色
|
10
|
+
* @default "currentColor"
|
11
|
+
*/
|
12
|
+
color?: string;
|
13
|
+
/**
|
14
|
+
* 自定义类名
|
15
|
+
*/
|
16
|
+
class?: string;
|
17
|
+
}
|
18
|
+
|
19
|
+
const { size = '24px', color = 'currentColor', class: className = '' } = Astro.props;
|
20
|
+
---
|
21
|
+
|
22
|
+
<svg
|
23
|
+
xmlns="http://www.w3.org/2000/svg"
|
24
|
+
width={size}
|
25
|
+
height={size}
|
26
|
+
viewBox="0 0 24 24"
|
27
|
+
fill={color}
|
28
|
+
class={className}
|
29
|
+
>
|
30
|
+
<path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z" />
|
31
|
+
</svg>
|