1
- import React from "react" ;
1
+ import React , { useEffect , useState } from "react" ;
2
2
import Link from "next/link" ;
3
+ import getLatestRepos from "@lib/getLatestRepos" ;
4
+ import userData from "@constants/data" ;
3
5
4
6
export default function LatestCode ( ) {
7
+ const [ repos , setRepos ] = useState ( [ ] ) ;
8
+
9
+ useEffect ( async ( ) => {
10
+ let latestRepos = await getLatestRepos ( userData ) ;
11
+ console . log ( "latestRepos" , latestRepos ) ;
12
+ setRepos ( latestRepos ) ;
13
+ // console.log(data);
14
+ console . log ( "repos" , repos ) ;
15
+ } , [ repos ] ) ;
5
16
return (
6
17
< section className = "bg-[#F1F1F1] -mt-40 dark:bg-gray-900 pb-40" >
7
18
< div className = "max-w-6xl mx-auto" >
@@ -11,7 +22,7 @@ export default function LatestCode() {
11
22
</ h1 >
12
23
13
24
< a
14
- href = " https://github.com/manuarora700"
25
+ href = { ` https://github.com/${ userData . githubUsername } ` }
15
26
className = "mb-20 md:mb-0 px-8 py-4 rounded-md bg-white shadow-lg text-xl font-semibold flex flex-row space-x-4 items-center dark:text-gray-700"
16
27
>
17
28
< svg
@@ -35,126 +46,34 @@ export default function LatestCode() {
35
46
</ div >
36
47
< div className = "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8 max-w-6xl mx-auto px-10 lg:-mt-10 gap-y-20" >
37
48
{ /* Single github Repo */ }
38
- < div className = "github-repo" >
39
- < h1 className = "font-semibold text-xl dark:text-gray-200 text-gray-700" >
40
- Tailwind Starter Portfolio Project
41
- </ h1 >
42
- < p className = "text-base font-normal my-4 text-gray-500" >
43
- Starting out with tailwindcss, Tailwind Master Kit provides an
44
- amazing starter kit which I've integrated in a boilerplate code.
45
- </ p >
46
- < a
47
- href = "https://github.com"
48
- className = "font-semibold group flex flex-row space-x-2 w-full items-center"
49
- >
50
- < p > View Repository </ p >
51
- < div className = "transform group-hover:translate-x-2 transition duration-300" >
52
- →
53
- </ div >
54
- </ a >
55
- </ div >
56
-
57
- { /* Single github Repo */ }
58
- < div className = "github-repo" >
59
- < h1 className = "font-semibold text-xl dark:text-gray-200 text-gray-700" >
60
- Javascript Mini Projects
61
- </ h1 >
62
- < p className = "text-base font-normal my-4 text-gray-500" >
63
- 20 Javascript mini projects - taught by Wes Bos - is a collection of
64
- 20 projects built with vanilla javascript.
65
- </ p >
66
- < a
67
- href = "https://github.com"
68
- className = "font-semibold group flex flex-row space-x-2 w-full items-center"
69
- >
70
- < p > View Repository </ p >
71
- < div className = "transform group-hover:translate-x-2 transition duration-300" >
72
- →
73
- </ div >
74
- </ a >
75
- </ div >
76
49
77
- { /* Single github Repo */ }
78
- < div className = "github-repo" >
79
- < h1 className = "font-semibold text-xl dark:text-gray-200 text-gray-700" >
80
- Music Streaming Project
81
- </ h1 >
82
- < p className = "text-base font-normal my-4 text-gray-500" >
83
- A spotify clone with included functionalities like playlist
84
- creation, user account creation, pause, play, repeat and shuffle
85
- music.
86
- </ p >
87
- < a
88
- href = "https://github.com"
89
- className = "font-semibold group flex flex-row space-x-2 w-full items-center"
90
- >
91
- < p > View Repository </ p >
92
- < div className = "transform group-hover:translate-x-2 transition duration-300" >
93
- →
94
- </ div >
95
- </ a >
96
- </ div >
97
- { /* Single github Repo */ }
98
- < div className = "github-repo" >
99
- < h1 className = "font-semibold text-xl dark:text-gray-200 text-gray-700" >
100
- Accept Payments With Razorpay
101
- </ h1 >
102
- < p className = "text-base font-normal my-4 text-gray-500" >
103
- Payment gateway integration using Razorpay with Next.js. Includes
104
- login and authentication with payments validation in test and
105
- production.
106
- </ p >
107
- < a
108
- href = "https://github.com"
109
- className = "font-semibold group flex flex-row space-x-2 w-full items-center"
110
- >
111
- < p > View Repository </ p >
112
- < div className = "transform group-hover:translate-x-2 transition duration-300" >
113
- →
114
- </ div >
115
- </ a >
116
- </ div >
117
-
118
- { /* Single github Repo */ }
119
- < div className = "github-repo" >
120
- < h1 className = "font-semibold text-xl dark:text-gray-200 text-gray-700" >
121
- Covid Resources Portal
122
- </ h1 >
123
- < p className = "text-base font-normal my-4 text-gray-500" >
124
- A covid resources portal - to get information and availability on
125
- beds, oxygen and Remdesivir - built with Next.js and tailwindcss.
126
- </ p >
127
- < a
128
- href = "https://github.com"
129
- className = "font-semibold group flex flex-row space-x-2 w-full items-center"
130
- >
131
- < p > View Repository </ p >
132
- < div className = "transform group-hover:translate-x-2 transition duration-300" >
133
- →
134
- </ div >
135
- </ a >
136
- </ div >
137
-
138
- { /* Single github Repo */ }
139
- < div className = "github-repo" >
140
- < h1 className = "font-semibold text-xl dark:text-gray-200 text-gray-700" >
141
- Expense Tracker Application
142
- </ h1 >
143
- < p className = "text-base font-normal my-4 text-gray-500" >
144
- A small javascript utility application that tracks your expenditure
145
- and savings on a daily basis. Get analytics delivered to your email.
146
- </ p >
147
- < a
148
- href = "https://github.com"
149
- className = "font-semibold group flex flex-row space-x-2 w-full items-center"
150
- >
151
- < p > View Repository </ p >
152
- < div className = "transform group-hover:translate-x-2 transition duration-300" >
153
- →
154
- </ div >
155
- </ a >
156
- </ div >
50
+ { repos &&
51
+ repos . map ( ( latestRepo , idx ) => (
52
+ < GithubRepoCard latestRepo = { latestRepo } key = "idx" />
53
+ ) ) }
157
54
</ div >
158
55
</ section >
159
56
) ;
160
57
}
58
+
59
+ const GithubRepoCard = ( { latestRepo } ) => {
60
+ return (
61
+ < div className = "github-repo" >
62
+ < h1 className = "font-semibold text-xl dark:text-gray-200 text-gray-700" >
63
+ { latestRepo . name }
64
+ </ h1 >
65
+ < p className = "text-base font-normal my-4 text-gray-500" >
66
+ { latestRepo . description }
67
+ </ p >
68
+ < a
69
+ href = { latestRepo . clone_url }
70
+ className = "font-semibold group flex flex-row space-x-2 w-full items-center"
71
+ >
72
+ < p > View Repository </ p >
73
+ < div className = "transform group-hover:translate-x-2 transition duration-300" >
74
+ →
75
+ </ div >
76
+ </ a >
77
+ </ div >
78
+ ) ;
79
+ } ;
0 commit comments