1
+ <template >
2
+ <div class =" container" >
3
+ <div class =" wrapper" >
4
+ <div class =" contributions-graph" >
5
+ <div class =" user" id =" user1" >
6
+ <div class =" user-info" >
7
+ <dl >
8
+ <dt >USER NAME</dt >
9
+ <dd class =" user-name" >{{ contributionsCollection.contribution_collections[0].user.github_user_name }}</dd >
10
+ <dt >TOTAL CONTRIBUTIONS</dt >
11
+ <dd class =" total-contributions" >{{ contributionsCollection.contribution_collections[0].total_count }}</dd >
12
+ </dl >
13
+ </div >
14
+ <div class =" graph" >
15
+ <svg viewbox =" 0 0 25 300" width =" 25" height =" 300" >
16
+ <line x1 =0 v-bind:y1 =" index * 5 + 2"
17
+ v-bind:x2 =" item.count" v-bind:y2 =" index * 5 + 2"
18
+ stroke-width =" 4" v-bind:opacity =" item.count / 10"
19
+ v-for =" (item, index) in contributionsCollection.contribution_collections[0].days"
20
+ v-bind:key =" item.date" ></line >
21
+ </svg >
22
+ </div >
23
+ </div >
24
+ <div class =" user" id =" user2" >
25
+ <div class =" user-info" >
26
+ <dl >
27
+ <dt >USER NAME</dt >
28
+ <dd class =" user-name" >{{ contributionsCollection.contribution_collections[1].user.github_user_name }}</dd >
29
+ <dt >TOTAL CONTRIBUTIONS</dt >
30
+ <dd class =" total-contributions" >{{ contributionsCollection.contribution_collections[1].total_count }}</dd >
31
+ </dl >
32
+ </div >
33
+ <div class =" graph" >
34
+ <svg viewbox =" 0 0 25 300" width =" 25" height =" 300" >
35
+ <line x1 =0 v-bind:y1 =" index * 5 + 2"
36
+ v-bind:x2 =" item.count" v-bind:y2 =" index * 5 + 2"
37
+ stroke-width =" 4" v-bind:opacity =" item.count / 10"
38
+ v-for =" (item, index) in contributionsCollection.contribution_collections[1].days"
39
+ v-bind:key =" item.date" ></line >
40
+ </svg >
41
+ </div >
42
+ </div >
43
+ <div class =" user" id =" user3" >
44
+ <div class =" user-info" >
45
+ <dl >
46
+ <dt >USER NAME</dt >
47
+ <dd class =" user-name" >{{ contributionsCollection.contribution_collections[2].user.github_user_name }}</dd >
48
+ <dt >TOTAL CONTRIBUTIONS</dt >
49
+ <dd class =" total-contributions" >{{ contributionsCollection.contribution_collections[2].total_count }}</dd >
50
+ </dl >
51
+ </div >
52
+ <svg viewbox =" 0 0 25 300" width =" 25" height =" 300" >
53
+ <line x1 =0 v-bind:y1 =" index * 5 + 2"
54
+ v-bind:x2 =" item.count" v-bind:y2 =" index * 5 + 2"
55
+ stroke-width =" 4" v-bind:opacity =" item.count / 10"
56
+ v-for =" (item, index) in contributionsCollection.contribution_collections[2].days"
57
+ v-bind:key =" item.date" ></line >
58
+ </svg >
59
+ </div >
60
+ </div >
61
+ </div >
62
+ </div >
63
+ </div >
64
+ </template >
65
+
66
+ <script >
67
+ import { mapState , mapActions } from ' vuex' ;
68
+
69
+ export default {
70
+ name: ' GitHubContributionsGraph' ,
71
+ computed: mapState (
72
+ ' contributionsCollection' , [' contributionsCollection' ],
73
+ ),
74
+ methods: {
75
+ ... mapActions (
76
+ ' contributionsCollection' , [' getContributionsCollection' ],
77
+ ),
78
+ },
79
+ async created () {
80
+ this .getContributionsCollection ();
81
+ },
82
+ };
83
+ </script >
84
+
85
+ <style scoped>
86
+ @keyframes rotate {
87
+ from { transform : rotateY (0deg ); }
88
+ to { transform : rotateY (360deg ); }
89
+ }
90
+ @keyframes inverse-rotate {
91
+ from { transform : rotateY (0deg ); }
92
+ to { transform : rotateY (-360deg ); }
93
+ }
94
+ @keyframes dash {
95
+ to {
96
+ stroke-dashoffset : 1000 ;
97
+ }
98
+ }
99
+ .contributions-graph {
100
+ animation : rotate 60s infinite linear ;
101
+ transform-style : preserve-3d ;
102
+ }
103
+ .graph {
104
+ transform-style : preserve-3d ;
105
+ border-top : 1px solid black ;
106
+ padding-top : 20px ;
107
+ }
108
+ svg {
109
+ width : 100% ;
110
+ transform-origin : top left ;
111
+ transform : scale (30 , 2 );
112
+ }
113
+ #user1 {
114
+ transform : rotateY (0deg );
115
+ stroke : rgb (24 , 112 , 228 );
116
+ }
117
+ #user2 {
118
+ transform : rotateY (120deg );
119
+ stroke : rgb (0 , 110 , 24 );
120
+ }
121
+ #user3 {
122
+ transform : rotateY (240deg );
123
+ stroke : rgb (212 , 127 , 0 );
124
+ }
125
+ #user4 {
126
+ transform : rotateY (270deg );
127
+ }
128
+ #user2 .user-info {
129
+ animation-delay : -20s ;
130
+ }
131
+ #user3 .user-info {
132
+ animation-delay : -40s ;
133
+ }
134
+ dl {
135
+ letter-spacing : -1px ;
136
+ }
137
+ dt {
138
+ font-size : 0.7em ;
139
+ line-height : 1px ;
140
+ }
141
+ .user-name {
142
+ font-size : 3rem ;
143
+ }
144
+ .total-contributions {
145
+ font-size : 3rem ;
146
+ }
147
+ .container {
148
+ perspective : 1000px ;
149
+ }
150
+ .wrapper {
151
+ font-family : ' Barlow' ;
152
+ font-weight : bold ;
153
+ height : 700px ;
154
+
155
+ transform : rotateX (-20deg );
156
+ transform-style : preserve-3d ;
157
+ width : 60% ;
158
+ margin : 50px auto ;
159
+ }
160
+ .user {
161
+ width : 50% ;
162
+ margin-left : 50% ;
163
+ position : absolute ;
164
+ transform-origin : 0 ;
165
+ transform-style : preserve-3d ;
166
+ }
167
+ .user-info {
168
+ margin-left : 70% ;
169
+ animation : inverse-rotate 60s infinite linear ;
170
+ border-top : 1px solid black ;
171
+ padding-top : 20px ;
172
+ }
173
+ </style >
0 commit comments