-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
445 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
const axios = require('axios'); | ||
import { NextResponse } from 'next/server'; | ||
import axios from 'axios'; | ||
|
||
async function getPopularRepositories() { | ||
export async function GET() { | ||
const url = 'https://api.github.com/search/repositories?q=stars:>10000&sort=stars'; | ||
try { | ||
const response = await axios.get(url); | ||
const repositories = response.data.items; | ||
return repositories; // This contains the most popular repositories | ||
return NextResponse.json(repositories); // This contains the most popular repositories | ||
} catch (error) { | ||
console.error('Error fetching repositories:', error); | ||
return NextResponse.json( | ||
{ error: 'Failed to fetch repositories' }, | ||
{ status: 500 } | ||
); | ||
} | ||
} | ||
|
||
getPopularRepositories().then(repos => { | ||
GET().then(repos => { | ||
console.log(repos); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { useState, useEffect } from "react"; | ||
|
||
const ProgressBar = () => { | ||
const [scrollProgress, setScrollProgress] = useState(0); | ||
|
||
// Update progress bar on scroll | ||
useEffect(() => { | ||
const handleScroll = () => { | ||
const totalHeight = | ||
document.documentElement.scrollHeight - window.innerHeight; | ||
const scrollPosition = window.pageYOffset; | ||
const scrollPercentage = (scrollPosition / totalHeight) * 100; | ||
setScrollProgress(scrollPercentage); | ||
}; | ||
|
||
window.addEventListener("scroll", handleScroll); | ||
return () => { | ||
window.removeEventListener("scroll", handleScroll); | ||
}; | ||
}, []); | ||
|
||
return ( | ||
<> | ||
<div | ||
className="progress-bar-container" | ||
style={{ | ||
position: "fixed", | ||
top: "0", | ||
left: "0", | ||
width: "100%", | ||
zIndex: "99999", | ||
height: "7px", | ||
}} | ||
> | ||
{/* Glowing Progress Bar */} | ||
<div | ||
className="progress-bar" | ||
style={{ | ||
border: "none", | ||
borderRadius: "2rem", | ||
height: "100%", | ||
width: `${scrollProgress}%`, | ||
background: "linear-gradient(90deg, #ffff ,#404f78)", | ||
boxShadow: "0 0 2px #ffff, 0 0 5px #404f78, 0 0 10px #2F80ED", | ||
}} | ||
></div> | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
export default ProgressBar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
"use client" | ||
|
||
import * as React from "react" | ||
import * as AccordionPrimitive from "@radix-ui/react-accordion" | ||
import { cn } from "@/lib/utils" | ||
import { ChevronDownIcon } from "@radix-ui/react-icons" | ||
|
||
const Accordion = AccordionPrimitive.Root | ||
|
||
const AccordionItem = React.forwardRef< | ||
React.ElementRef<typeof AccordionPrimitive.Item>, | ||
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item> | ||
>(({ className, ...props }, ref) => ( | ||
<AccordionPrimitive.Item | ||
ref={ref} | ||
className={cn("border-b", className)} | ||
{...props} | ||
/> | ||
)) | ||
AccordionItem.displayName = "AccordionItem" | ||
|
||
const AccordionTrigger = React.forwardRef< | ||
React.ElementRef<typeof AccordionPrimitive.Trigger>, | ||
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger> | ||
>(({ className, children, ...props }, ref) => ( | ||
<AccordionPrimitive.Header className="flex"> | ||
<AccordionPrimitive.Trigger | ||
ref={ref} | ||
className={cn( | ||
"flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline text-left [&[data-state=open]>svg]:rotate-180", | ||
className | ||
)} | ||
{...props} | ||
> | ||
{children} | ||
<ChevronDownIcon className="h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200" /> | ||
</AccordionPrimitive.Trigger> | ||
</AccordionPrimitive.Header> | ||
)) | ||
AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName | ||
|
||
const AccordionContent = React.forwardRef< | ||
React.ElementRef<typeof AccordionPrimitive.Content>, | ||
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content> | ||
>(({ className, children, ...props }, ref) => ( | ||
<AccordionPrimitive.Content | ||
ref={ref} | ||
className="overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down" | ||
{...props} | ||
> | ||
<div className={cn("pb-4 pt-0", className)}>{children}</div> | ||
</AccordionPrimitive.Content> | ||
)) | ||
AccordionContent.displayName = AccordionPrimitive.Content.displayName | ||
|
||
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.