Skip to content

Commit 286460d

Browse files
authored
style : added styling to the insertion sort and merge sort
Merge pull request #21 from Sohan-Rout/main1
2 parents 4dc11dc + 5aeff48 commit 286460d

File tree

19 files changed

+328
-287
lines changed

19 files changed

+328
-287
lines changed

app/visualizer/page.jsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,16 @@ export const metadata = {
5555
'DSA with Code'
5656
],
5757
robots: 'index, follow',
58+
openGraph: {
59+
images: [
60+
{
61+
url: "/og/visualizer.png",
62+
width: 1200,
63+
height: 630,
64+
alt: "Algorithm Visualization",
65+
},
66+
],
67+
},
5868
};
5969

6070
const sections = [

app/visualizer/searching/binarysearch/page.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const metadata = {
4444
openGraph: {
4545
images: [
4646
{
47-
url: "/og/binarySearch.png",
47+
url: "/og/searching/binarySearch.png",
4848
width: 1200,
4949
height: 630,
5050
alt: "Binary Search Algorithm Visualization",

app/visualizer/searching/linearsearch/page.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const metadata = {
4444
openGraph: {
4545
images: [
4646
{
47-
url: "/og/linearSearch.png",
47+
url: "/og/searching/linearSearch.png",
4848
width: 1200,
4949
height: 630,
5050
alt: "Linear Search Algorithm Visualization",

app/visualizer/sorting/insertionsort/animation.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ const InsertionSortVisualizer = () => {
234234
</div>
235235

236236
{/* Visualization */}
237-
<div className="bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md border border-gray-200 dark:border-gray-700">
237+
<div className="bg-white dark:bg-neutral-950 p-6 rounded-lg shadow-md border border-gray-200 dark:border-gray-700">
238238
<h2 className="text-xl font-semibold mb-4">Array Visualization</h2>
239239
{array.length > 0 ? (
240240
<div className="flex flex-wrap gap-4 justify-center">

app/visualizer/sorting/insertionsort/codeBlock.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,10 @@ int main() {
226226
initial={{ opacity: 0, y: 20 }}
227227
animate={{ opacity: 1, y: 0 }}
228228
transition={{ duration: 0.3 }}
229-
className="bg-white dark:bg-gray-800 rounded-xl shadow-lg overflow-hidden border border-gray-200 dark:border-gray-700 transition-colors duration-300"
229+
className="bg-white dark:bg-neutral-950 rounded-xl shadow-lg overflow-hidden border border-gray-200 dark:border-gray-700 transition-colors duration-300"
230230
>
231231
{/* Header */}
232-
<div className="flex flex-col sm:flex-row justify-between items-start sm:items-center p-4 bg-gray-50 dark:bg-gray-700/50 border-b border-gray-200 dark:border-gray-700">
232+
<div className="flex flex-col sm:flex-row justify-between items-start sm:items-center p-4 bg-gray-50 dark:bg-neutral-950 border-b border-gray-200 dark:border-gray-700">
233233
<div className="flex items-center mb-2 sm:mb-0">
234234
<FaCode className="text-blue-500 mr-2 text-lg" />
235235
<h3 className="text-lg font-semibold text-gray-800 dark:text-white">

app/visualizer/sorting/insertionsort/page.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,4 @@ export default function Page() {
124124
<Footer />
125125
</>
126126
);
127-
}
127+
}

app/visualizer/sorting/insertionsort/quiz.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,22 +181,22 @@ const InsertionSortQuiz = () => {
181181
};
182182

183183
return (
184-
<section className="max-w-4xl mx-auto shadow-lg rounded-xl bg-white dark:bg-gray-800 mt-8 mb-8 p-6 border border-gray-200 dark:border-gray-700">
184+
<section className="max-w-4xl mx-auto shadow-lg rounded-xl bg-white dark:bg-neutral-950 mt-8 mb-8 p-6 border border-gray-200 dark:border-gray-700">
185185
{showIntro ? (
186186
<motion.div
187187
initial={{ opacity: 0, y: 20 }}
188188
animate={{ opacity: 1, y: 0 }}
189189
className="text-center"
190190
>
191191
<div className="flex justify-center mb-6">
192-
<div className="bg-blue-100 dark:bg-blue-900/30 p-4 rounded-full">
192+
<div className="bg-blue-100 dark:bg-neutral-900 p-4 rounded-full">
193193
<FaAward className="text-4xl text-blue-500 dark:text-blue-500" />
194194
</div>
195195
</div>
196196
<h2 className="text-2xl font-bold mb-4 text-black dark:text-gray-100">
197197
Insertion Sort Quiz Challenge
198198
</h2>
199-
<div className="bg-white dark:bg-gray-700 p-4 rounded-lg mb-6 text-left shadow-inner">
199+
<div className="bg-white dark:bg-neutral-900 p-4 rounded-lg mb-6 text-left shadow-inner">
200200
<h3 className="font-bold mb-2 flex items-center text-blue-600 dark:text-blue-400">
201201
<FaInfoCircle className="mr-2" /> How it works:
202202
</h3>

app/visualizer/sorting/mergesort/animation.jsx

Lines changed: 1 addition & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
"use client";
22
import React, { useState, useRef, useEffect } from "react";
33
import { gsap } from "gsap";
4-
import Footer from "@/app/components/footer";
5-
import Content from "@/app/visualizer/sorting/mergesort/content";
64
import ArrayGenerator from "@/app/components/ui/randomArray";
75
import CustomArrayInput from "@/app/components/ui/customArrayInput";
8-
import ExploreOther from "@/app/components/ui/exploreOther";
9-
import CodeBlock from "@/app/visualizer/sorting/mergesort/codeBlock";
10-
import Quiz from "@/app/visualizer/sorting/mergesort/quiz";
11-
import GoBackButton from "@/app/components/ui/goback";
12-
import BackToTop from "@/app/components/ui/backtotop";
136

147
const MergeSortVisualizer = () => {
158
const [array, setArray] = useState([]);
@@ -228,20 +221,7 @@ const MergeSortVisualizer = () => {
228221

229222

230223
return (
231-
<div className="min-h-screen max-h-auto bg-gray-100 dark:bg-zinc-950 text-gray-800 dark:text-gray-200">
232-
<main className="container mx-auto px-6 pt-16 pb-4">
233-
234-
{ /* go back block here */}
235-
<div className="mt-10 sm:mt-10">
236-
<GoBackButton />
237-
</div>
238-
239-
{ /* main logic here */}
240-
<h1 className="text-4xl md:text-4xl mt-6 ml-10 font-bold text-left text-gray-900 dark:text-white mb-0">
241-
<span className="text-black dark:text-white">Merge Sort</span>
242-
</h1>
243-
<div className='bg-black border border-none dark:bg-gray-600 w-100 h-[2px] rounded-xl mt-2 mb-5'></div>
244-
<Content />
224+
<main className="container mx-auto px-6 pt-2 pb-6">
245225
<p className="text-lg text-center text-gray-600 dark:text-gray-400 mb-8">
246226
Visualize the divide-and-conquer approach of Merge Sort with recursive
247227
splitting and merging.
@@ -364,57 +344,8 @@ const MergeSortVisualizer = () => {
364344
</div>
365345
)}
366346
</div>
367-
368-
{/* Enhanced Recursion Tree */}
369-
370-
{/* Algorithm Explanation with Visual Guide */}
371-
<div className="bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md border border-gray-200 dark:border-gray-700 mt-8">
372-
<h2 className="text-xl font-semibold mb-4">Merge Sort Process</h2>
373-
<div>
374-
<div>
375-
<h3 className="font-medium mb-2">Steps:</h3>
376-
<ol className="list-decimal pl-5 space-y-2">
377-
<li>
378-
Divide array into halves recursively until single elements
379-
</li>
380-
<li>Merge adjacent subarrays in sorted order</li>
381-
<li>Continue merging until whole array is sorted</li>
382-
</ol>
383-
</div>
384-
</div>
385-
</div>
386347
</div>
387-
388-
{ /* quiz block here */}
389-
<p className="text-lg text-center text-gray-600 dark:text-gray-400 mt-8 mb-8">
390-
Test Your Knowledge before moving forward!
391-
</p>
392-
<Quiz />
393-
394-
<CodeBlock />
395-
<ExploreOther
396-
title="Explore Sorting Algorithms"
397-
links={[
398-
{
399-
text: "Selection Sort",
400-
url: "/visualizer/sorting/selectionsort",
401-
},
402-
{ text: "Bubble Sort", url: "/visualizer/sorting/bubblesort" },
403-
{
404-
text: "Insertion Sort",
405-
url: "/visualizer/sorting/insertionsort",
406-
},
407-
{ text: "Quick Sort", url: "/visualizer/sorting/quicksort" },
408-
{ text: "Heap Sort", url: "/algorithms/sorting/heap" },
409-
]}
410-
/>
411348
</main>
412-
<div>
413-
<div className="bg-gray-700 z-10 h-[1px]"></div>
414-
</div>
415-
<BackToTop/>
416-
<Footer />
417-
</div>
418349
);
419350
};
420351

0 commit comments

Comments
 (0)