File tree Expand file tree Collapse file tree 1 file changed +46
-7
lines changed Expand file tree Collapse file tree 1 file changed +46
-7
lines changed Original file line number Diff line number Diff line change 1
1
<template >
2
- <span id =" github-btn" class =" github-btn" >
3
- <a class =" gh-btn" href =" https://github.com/vueComponent/ant-design-vue" target =" _blank" >
4
- <span class =" gh-ico" aria-hidden =" true" ></span >
5
- <span class =" gh-text" >Star</span >
6
- </a >
7
- </span >
2
+ <a-tooltip placement =" bottom" >
3
+ <template #title >Github</template >
4
+ <span id =" github-btn" class =" github-btn" :style =" githubIconStyles" >
5
+ <a class =" gh-btn" href =" https://github.com/vueComponent/ant-design-vue" target =" _blank" >
6
+ <GithubOutlined class =" github-icon" />
7
+ </a >
8
+ </span >
9
+ </a-tooltip >
8
10
</template >
11
+
12
+ <script lang="ts">
13
+ import { defineComponent , inject , computed } from ' vue' ;
14
+ import { GithubOutlined } from ' @ant-design/icons-vue' ;
15
+ export default defineComponent ({
16
+ components: {
17
+ GithubOutlined ,
18
+ },
19
+ setup() {
20
+ const themeMode = inject (' themeMode' );
21
+ const githubIconStyles = computed (() => {
22
+ let iconBackgroundColor = ' rgba(0,0,0,0.06)' ;
23
+ if ((themeMode as any ).theme .value === ' dark' ) {
24
+ iconBackgroundColor = ' rgba(255,255,255,0.12)' ;
25
+ }
26
+ return {
27
+ ' --github-icon-background-color' : iconBackgroundColor ,
28
+ };
29
+ });
30
+ return {
31
+ githubIconStyles ,
32
+ };
33
+ },
34
+ });
35
+ </script >
36
+
9
37
<style lang="less" scoped>
10
38
@import ' ./Github.less' ;
11
39
#github-btn {
14
42
height : auto ;
15
43
16
44
.gh-btn {
45
+ color : currentColor ;
17
46
height : auto ;
18
- padding : 1 px 4 px ;
47
+ padding : 6 px ;
19
48
background : transparent ;
20
49
border : 0 ;
50
+ transition : all 0.2s ;
51
+
52
+ & :hover {
53
+ background : var (--github-icon-background-color );
54
+ }
21
55
22
56
.gh-ico {
23
57
width : 20px ;
30
64
}
31
65
}
32
66
67
+ .github-icon {
68
+ font-size : 18px ;
69
+ color : var (--text-color );
70
+ }
71
+
33
72
.gh-count {
34
73
height : auto ;
35
74
padding : 4px 8px ;
You can’t perform that action at this time.
0 commit comments