Skip to content

Commit 5dc0025

Browse files
committed
implemented github service
1 parent 734a780 commit 5dc0025

14 files changed

Lines changed: 258 additions & 41 deletions

File tree

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
GH_API_URL=
2+
GH_AUTH_TOKEN=

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ yarn-error.log*
2727

2828
# local env files
2929
.env*.local
30+
.env
3031

3132
# vercel
3233
.vercel

next.config.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
1+
// const nextEnv = require('next-env');
2+
// const dotenvLoad = require('dotenv-load');
3+
4+
// dotenvLoad();
5+
6+
// const withNextEnv = nextEnv();
7+
8+
// module.exports = withNextEnv({
9+
// // Your Next.js config.
10+
// });
11+
12+
113
/** @type {import('next').NextConfig} */
214
const nextConfig = {
315
reactStrictMode: true,
416
swcMinify: true,
517
}
618

7-
module.exports = nextConfig
19+
module.exports = nextConfig

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@
1212
"@types/node": "18.11.11",
1313
"@types/react": "18.0.26",
1414
"@types/react-dom": "18.0.9",
15+
"axios": "^1.2.1",
1516
"clsx": "^1.2.1",
17+
"dotenv-load": "^2.0.1",
1618
"eslint": "8.29.0",
1719
"eslint-config-next": "13.0.6",
1820
"next": "13.0.6",
21+
"next-env": "^1.1.1",
1922
"next-progress": "^2.2.0",
2023
"next-themes": "^0.2.1",
2124
"phosphor-react": "^1.4.1",

src/@Types/api.github.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export type PropsCardBox = {
2+
id?: number
3+
repoTitle: string
4+
vercelURL?: string
5+
repoDescription: string
6+
amountStars: number
7+
language: string
8+
lastEdition: string
9+
githubUrl: string
10+
}

src/@Types/useeffectprops.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { Dispatch, SetStateAction } from "react";
2+
3+
export type useEffectProps = {
4+
isOpenedModal: boolean
5+
setIsOpenedModal: Dispatch<SetStateAction<boolean>>
6+
}

src/api/github/repos.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
2+
import type { NextApiRequest, NextApiResponse } from 'next'
3+
import { PropsCardBox } from '../../@Types/api.github';
4+
5+
import api from '../../service/api';
6+
7+
const handler = async (
8+
req: NextApiRequest,
9+
res: NextApiResponse<PropsCardBox>
10+
) => {
11+
// const [ repos, setRepos ] = useState<PropsRepository[]>([]);
12+
13+
// await fetch('https://api.github.com/users/dc7devs/repos')
14+
// .then((repositories) => {
15+
// console.log(repositories.json())
16+
// .map((repo: any) => {
17+
// const data: PropsRepository = {
18+
// nameRepo: repo.data.name,
19+
// descriptionRepo: repo.description,
20+
// starsCount: repo.stargazers_count,
21+
// language: repo.language,
22+
// lastEdition: repo.updated_at,
23+
// githubRepositoryUrl: repo.html_url
24+
// }
25+
26+
// })
27+
// })
28+
29+
// res.status(200).json(repos);
30+
}
31+
32+
export default handler;

src/api/hello.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ export default function handler (
99
req: NextApiRequest,
1010
res: NextApiResponse<Data>
1111
) {
12-
res.status(200).json({ name: 'John Doe' })
12+
res.status(200).json({ name: '' })
1313
}

src/components/card-project.tsx

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,49 @@
11
import Link from "next/link";
2-
import cx from "clsx";
32
import { Star } from "phosphor-react";
3+
import { PropsCardBox } from "../@Types/api.github";
4+
5+
import cx from "clsx";
6+
7+
export default function CardBox({
8+
repoTitle,
9+
vercelURL,
10+
repoDescription,
11+
amountStars,
12+
language,
13+
lastEdition,
14+
githubUrl,
15+
}: PropsCardBox) {
416

5-
interface PropsCardButton {
6-
repoTitle: string
7-
vercelURL: string
8-
repoDescription: string
9-
amountStars: Number
10-
highlightLanguage: string
11-
lastEdition: string
12-
githubRepositoryUrl: string
13-
}
14-
15-
export default function CardButton() {
1617
return (
17-
<div className={"w-full sm:w-96 md:w-96 lg:w-[350px] h-48 dark:bg-black/45 bg-white/45 flex flex-col px-4 py-2.5 rounded backdrop-blur-sm ring-1 dark:ring-white/25 ring-black/25"}>
18-
<div className={"flex justify-between items-center px-1"}>
19-
<div className={"text-2xl text-black dark:text-white"}>ui-notion.so</div>
20-
<Link href={cx("")} className={"text-4xl text-zinc-500 hover:text-black dark:hover:text-zinc-100 hover:transition-colors ease-in select-none"}></Link>
18+
<div className="w-full sm:w-96 md:w-96 lg:w-[350px] h-48 dark:bg-black/45 bg-white/45 flex flex-col px-4 py-2.5 rounded backdrop-blur-sm ring-1 dark:ring-white/25 ring-black/25">
19+
<div className="flex justify-between items-center px-1">
20+
<div className="text-2xl text-black dark:text-white">{repoTitle}</div>
21+
<Link
22+
href={cx(vercelURL)}
23+
className="text-4xl text-zinc-500 hover:text-black dark:hover:text-zinc-100 hover:transition-colors ease-in select-none"
24+
target="__blank"
25+
></Link>
2126
</div>
2227

23-
<div className={"flex-1 overflow-hidden text-ellipsis py-3 pl-2"}>
24-
Notion's product interface, a project developed as a way of retaining knowledge acquired in the discipline of programming for the web
25-
</div>
28+
<div className="flex-1 overflow-hidden text-ellipsis py-3 pl-2">{repoDescription}</div>
2629

27-
<div className={"flex justify-between items-center"}>
30+
<div className="flex justify-between items-center text-zinc-500">
2831
<div className="flex justify-items-stretch items-center">
29-
<span className={cx("w-3 h-3 bg-blue-600 rounded-full mr-1")}></span>
32+
<span className="w-3 h-3 bg-blue-600 rounded-full mr-1"></span>
3033

31-
<div className="text-xs">TypeScript</div>
34+
<div className="text-xs">{language}</div>
3235

3336
<span className="w-1 h-1 rounded-full dark:bg-white bg-black rounded-full mx-2"></span>
3437
<div className="text-xs flex">
3538
<Star size={15} />
36-
<div className="ml-px">120</div>
39+
<div className="ml-px">{cx(amountStars ?? "0")}</div>
3740
</div>
3841
<span className="w-1 h-1 rounded-full dark:bg-white bg-black rounded-full mx-2"></span>
3942

4043
<div className="text-xs">Update {cx("49 min")} ago</div>
4144
</div>
4245

43-
<Link href={cx("")}>
46+
<Link href={githubUrl} target="__blank">
4447
<svg viewBox="0 0 24 24" aria-hidden="true" className="h-6 w-6 fill-zinc-500 hover:transition hover:fill-zinc-600 dark:fill-zinc-400 dark:hover:fill-zinc-300"><path fillRule="evenodd" clipRule="evenodd" d="M12 2C6.475 2 2 6.588 2 12.253c0 4.537 2.862 8.369 6.838 9.727.5.09.687-.218.687-.487 0-.243-.013-1.05-.013-1.91C7 20.059 6.35 18.957 6.15 18.38c-.113-.295-.6-1.205-1.025-1.448-.35-.192-.85-.667-.013-.68.788-.012 1.35.744 1.538 1.051.9 1.551 2.338 1.116 2.912.846.088-.666.35-1.115.638-1.371-2.225-.256-4.55-1.14-4.55-5.062 0-1.115.387-2.038 1.025-2.756-.1-.256-.45-1.307.1-2.717 0 0 .837-.269 2.75 1.051.8-.23 1.65-.346 2.5-.346.85 0 1.7.115 2.5.346 1.912-1.333 2.75-1.05 2.75-1.05.55 1.409.2 2.46.1 2.716.637.718 1.025 1.628 1.025 2.756 0 3.934-2.337 4.806-4.562 5.062.362.32.675.936.675 1.897 0 1.371-.013 2.473-.013 2.82 0 .268.188.589.688.486a10.039 10.039 0 0 0 4.932-3.74A10.447 10.447 0 0 0 22 12.253C22 6.588 17.525 2 12 2Z"></path></svg>
4548
</Link>
4649
</div>

src/components/navbar.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
import Link from "next/link";
22
import { useRouter } from "next/router";
33
import { CirclesFour, CirclesThreePlus, X } from "phosphor-react";
4-
import { Dispatch, SetStateAction, useState } from "react";
5-
import cx from "clsx";
4+
import { useState } from "react";
5+
import { useEffectProps } from "../@Types/useeffectprops";
66
import ToggleThemeBtn from "./toggle-dark-theme-btn";
7-
8-
type useEffectProps = {
9-
isOpenedModal: boolean
10-
setIsOpenedModal: Dispatch<SetStateAction<boolean>>
11-
}
7+
import cx from "clsx";
128

139
export default function NavBar({
1410
isOpenedModal,

0 commit comments

Comments
 (0)