Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement-popular-algos-part #24

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions src/components/Homepage/PopularAlgorithmsSection.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import React from "react";
import { motion } from "framer-motion";
import Link from '@docusaurus/Link'; // Importing Docusaurus Link

const PopularAlgorithmsSection: React.FC = () => {
const algorithms = [
{ title: "Binary Search", description: "Efficient searching in a sorted array" },
{ title: "Merge Sort", description: "Divide and conquer sorting algorithm" },
{ title: "Dijkstra's Algorithm", description: "Shortest path in weighted graphs" },
{ title: "Quick Sort", description: "Efficient in-place sorting algorithm" },
{ title: "Depth First Search", description: "Explore graph/tree depth-wise" },
{ title: "Breadth First Search", description: "Explore graph/tree level-wise" },
{ title: "Binary Search", description: "Efficient searching in a sorted array", link: "" },
{ title: "Merge Sort", description: "Divide and conquer sorting algorithm", link: "" },
{ title: "Dijkstra's Algorithm", description: "Shortest path in weighted graphs", link: "/docs/graphs" },
{ title: "Quick Sort", description: "Efficient in-place sorting algorithm", link: "" },
{ title: "Depth First Search", description: "Explore graph/tree depth-wise", link: "/docs/graphs" },
{ title: "Breadth First Search", description: "Explore graph/tree level-wise", link: "/docs/graphs" },
];

return (
Expand All @@ -22,15 +23,15 @@ const PopularAlgorithmsSection: React.FC = () => {
{algorithms.map((algorithm, index) => (
<motion.div
key={index}
className="relative p-6 bg-white dark:bg-gray-800 rounded-lg shadow-lg overflow-hidden transition-transform duration-300 ease-in-out hover:shadow-2xl"
className="relative p-6 bg-white dark:bg-gray-800 rounded-lg shadow-lg overflow-hidden transition-transform duration-300 ease-in-out hover:shadow-2xl cursor-pointer" // Added cursor-pointer
initial={{ scale: 1 }}
whileHover={{ scale: 1.05 }} // Scale on hover
whileTap={{ scale: 0.95 }} // Scale down on tap
>
<motion.div
className="absolute inset-0 border-2 border-transparent rounded-lg"
initial={{ borderColor: "transparent" }}
whileHover={{ borderColor: "#3b82f6" }} // Blue color on hover
whileHover={{ borderColor: "#3b82f6", backgroundColor: "#3b82f6" }} // Add blue background on hover
transition={{ duration: 0.3 }}
/>
<div className="relative z-10">
Expand All @@ -40,6 +41,12 @@ const PopularAlgorithmsSection: React.FC = () => {
<p className="text-gray-600 dark:text-gray-300">
{algorithm.description}
</p>
<Link
to={algorithm.link}
className="inline-block bg-blue-600 text-white px-4 py-2 rounded shadow transition-colors duration-300 hover:bg-blue-700 hover:text-black"
>
Learn More
</Link>
</div>
</motion.div>
))}
Expand Down
Loading