diff --git a/README.md b/README.md index 282ed11..1595e0f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ ![Portfolio demo](https://github.com/knowankit/knowankit.com/blob/develop/demo.gif) +

Twitter: Ankit Kumar diff --git a/components/homepage/index.tsx b/components/homepage/index.tsx index d225dc1..471f03f 100644 --- a/components/homepage/index.tsx +++ b/components/homepage/index.tsx @@ -4,10 +4,10 @@ import Navbar from '@/components/navbar'; import RecentBlog from '@/components/homepage/recent-blog-card'; import RecentProject from '@/components/homepage/recent-project-card'; import Footer from '@/components/footer'; -import getAllGithubStars from '@/lib/get-all-github-stars'; +import { getAllGithubStars } from '@/lib/get-all-github-stars'; import { AiOutlineGithub } from 'react-icons/ai'; import projects from '@/data/projects'; -import router, { useRouter } from 'next/router'; +import router from 'next/router'; const Profile = ({ posts }) => { useEffect(() => { diff --git a/components/projects/project-card.tsx b/components/projects/project-card.tsx index 9ec2e96..ccff2c8 100644 --- a/components/projects/project-card.tsx +++ b/components/projects/project-card.tsx @@ -1,12 +1,13 @@ import React from 'react'; import { Box, Heading, Text, Stack, useColorModeValue } from '@chakra-ui/react'; -import { AiFillGithub } from 'react-icons/ai'; import Link from 'next/link'; const ProjectCard = ({ project }) => { + if (project.fork) return <>; + return ( - + { {project.name} {project.description} - - {project.demo && ( - - Preview - - )} - {project.github && ( - - - - )} - diff --git a/components/projects/search-project.tsx b/components/projects/search-project.tsx index 13d545b..5681cf3 100644 --- a/components/projects/search-project.tsx +++ b/components/projects/search-project.tsx @@ -1,13 +1,25 @@ -import React, { useState } from 'react'; +import React, { useState, useEffect } from 'react'; import ProjectCard from '@/components/projects/project-card'; import { Box, InputGroup, InputRightElement, Input } from '@chakra-ui/react'; import projects from '@/data/projects'; +import { getRepos } from '@/lib/get-all-github-stars'; import { AiOutlineSearch } from 'react-icons/ai'; const SearchProject = () => { const [filteredList, setFilteredList] = useState(projects); const [searchText, setSearchText] = useState(''); + useEffect(() => { + async function fetchMyAPI() { + const data = await getRepos(); + + const sortedData = data.sort((a, b) => b['stargazers_count'] - a['stargazers_count']); + setFilteredList(sortedData); + } + + fetchMyAPI(); + }, []); + const handleChange = (e) => { const inputValue = e.target.value; setSearchText(inputValue); diff --git a/lib/get-all-github-stars.ts b/lib/get-all-github-stars.ts index 74456c9..d982ce3 100644 --- a/lib/get-all-github-stars.ts +++ b/lib/get-all-github-stars.ts @@ -12,4 +12,12 @@ const getAllGithubStars = async () => { return stars; }; -export default getAllGithubStars; +const getRepos = async () => { + const URL = 'https://api.github.com/users/knowankit/repos'; + const response = await fetch(URL); + const data = await response.json(); + + return data; +}; + +export { getAllGithubStars, getRepos }; diff --git a/lib/mdx.ts b/lib/mdx.ts index 72a7471..776c0cb 100644 --- a/lib/mdx.ts +++ b/lib/mdx.ts @@ -1,3 +1,5 @@ +/* eslint-disable */ + import fs from 'fs'; import matter from 'gray-matter'; import path from 'path'; diff --git a/next-env.d.ts b/next-env.d.ts index 9bc3dd4..4f11a03 100644 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -1,5 +1,4 @@ /// -/// /// // NOTE: This file should not be edited diff --git a/tsconfig.json b/tsconfig.json index cc568d8..7d5be48 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,11 +1,7 @@ { "compilerOptions": { "target": "es5", - "lib": [ - "dom", - "dom.iterable", - "esnext" - ], + "lib": ["dom", "dom.iterable", "esnext"], "baseUrl": ".", "paths": { "@/src/*": ["src/*"], @@ -29,12 +25,6 @@ "isolatedModules": true, "jsx": "preserve" }, - "include": [ - "next-env.d.ts", - "**/*.ts", - "**/*.tsx" - ], - "exclude": [ - "node_modules" - ] + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], + "exclude": ["node_modules"] }