Merge pull request 'dynamic card' (#21) from rajesh into main

Reviewed-on: #21
This commit is contained in:
dhanush.s 2025-09-26 20:02:08 +00:00
commit 94315ae34d
10 changed files with 72 additions and 57 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 652 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

View File

@ -4,7 +4,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Kodepilot Clone</title> <title>Kodepilot</title>
<link rel="stylesheet" href="main.css"> <link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="templateapi/main.css"> <link rel="stylesheet" href="templateapi/main.css">
<link rel="icon" type="image/x-icon" href="assets/images/logo/favicon.ico"> <link rel="icon" type="image/x-icon" href="assets/images/logo/favicon.ico">
@ -553,7 +553,7 @@
<a href="#" class="practice-cta-btn">Start Now ➤</a> <a href="#" class="practice-cta-btn">Start Now ➤</a>
</div> </div>
<div class="practice-card-svg"> <div class="practice-card-svg">
<img src="assets/images/mit-ico/ebmpapst.svg" alt="Coding Practice"> <img src="assets/images/codinghiringassesments/nope_1.png" alt="Coding Practice">
</div> </div>
</div> </div>
@ -569,7 +569,7 @@
<a href="#" class="practice-cta-btn">Start Now ➤</a> <a href="#" class="practice-cta-btn">Start Now ➤</a>
</div> </div>
<div class="practice-card-svg"> <div class="practice-card-svg">
<img src="assets/images/mit-ico/ebmpapst.svg" alt="Coding Practice"> <img src="assets/images/codinghiringassesments/nope_2.png" alt="Coding Practice">
</div> </div>
</div> </div>
@ -585,7 +585,7 @@
<a href="#" class="practice-cta-btn">Start Now ➤</a> <a href="#" class="practice-cta-btn">Start Now ➤</a>
</div> </div>
<div class="practice-card-svg"> <div class="practice-card-svg">
<img src="assets/images/mit-ico/ebmpapst.svg" alt="Coding Practice"> <img src="assets/images/codinghiringassesments/nope_3.webp" alt="Coding Practice">
</div> </div>
</div> </div>
@ -601,7 +601,7 @@
<a href="#" class="practice-cta-btn">Start Now ➤</a> <a href="#" class="practice-cta-btn">Start Now ➤</a>
</div> </div>
<div class="practice-card-svg"> <div class="practice-card-svg">
<img src="assets/images/mit-ico/ebmpapst.svg" alt="Coding Practice"> <img src="assets/images/codinghiringassesments/nope_4.webp" alt="Coding Practice">
</div> </div>
</div> </div>
</div> </div>

119
main.css
View File

@ -1544,6 +1544,7 @@
/* Practice Cards Component CSS - Unique class names to prevent conflicts */ /* Practice Cards Component CSS - Unique class names to prevent conflicts */
/* Practice Cards Component CSS - Unique class names to prevent conflicts */
/* Practice Cards Component CSS - Unique class names to prevent conflicts */ /* Practice Cards Component CSS - Unique class names to prevent conflicts */
.practice-cards-container * { .practice-cards-container * {
margin: 0; margin: 0;
@ -1632,10 +1633,14 @@
position: relative; position: relative;
} }
/* Default state - all cards equal size */ /* Default state - first card expanded */
.practice-card { .practice-card:first-child {
flex: 2.5;
z-index: 10;
}
.practice-card:not(:first-child) {
flex: 1; flex: 1;
transform: scale(1);
} }
.practice-card .practice-card-svg { .practice-card .practice-card-svg {
@ -1648,18 +1653,45 @@
transform: translateY(15px); transform: translateY(15px);
} }
/* Hover state - expand hovered card, shrink others */ /* Show SVG and CTA for first card by default */
.practice-cards-wrapper:hover .practice-card { .practice-card:first-child .practice-card-svg {
flex: 1; width: 35%;
transform: scale(0.98); opacity: 1;
} }
.practice-cards-wrapper:hover .practice-card:hover { .practice-card:first-child .practice-cta-btn {
opacity: 1;
transform: translateY(0);
}
.practice-card:first-child .practice-card-icon {
transform: scale(1.05) rotate(3deg);
}
.practice-card:first-child h3 {
transform: translateY(-2px);
}
.practice-card:first-child p,
.practice-card:first-child .practice-meta-info,
.practice-card:first-child .practice-footer-text {
transform: translateY(-1px);
}
/* Hover state - expand hovered card, shrink others */
.practice-cards-wrapper .practice-card {
transform: scale(1);
}
.practice-cards-wrapper .practice-card:hover {
flex: 2.5; flex: 2.5;
transform: translateY(-6px) scale(1.01);
z-index: 10; z-index: 10;
} }
.practice-cards-wrapper .practice-card:not(:hover) {
flex: 1;
}
/* Color changes for hover states */ /* Color changes for hover states */
.practice-card:nth-child(1):hover { .practice-card:nth-child(1):hover {
background-color: #89CFF0; background-color: #89CFF0;
@ -1677,7 +1709,7 @@
background-color: #FFE186; background-color: #FFE186;
} }
/* SVG Container */ /* SVG Container - UPDATED FOR IMAGES */
.practice-card-svg { .practice-card-svg {
width: 0; width: 0;
height: 100%; height: 100%;
@ -1689,18 +1721,21 @@
padding: 20px; padding: 20px;
background: transparent; background: transparent;
flex-shrink: 0; flex-shrink: 0;
overflow: hidden; /* Added to contain the image */
} }
.practice-card-svg svg { /* Image styling - NEW RULES */
width: 100%; .practice-card-svg img {
height: 100%; width: 500%;
max-width: 150px; height:1200%;
max-height: 150px; object-fit: contain; /* This will scale the image properly */
filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1)); max-width: 200%;
max-height: 200%;
border-radius: 8px;
} }
/* Show SVG only on hovered card */ /* Show SVG only on hovered card and first card by default */
.practice-cards-wrapper:hover .practice-card:hover .practice-card-svg { .practice-card:hover .practice-card-svg {
width: 35%; width: 35%;
opacity: 1; opacity: 1;
} }
@ -1738,7 +1773,7 @@
} }
/* Icon animation on hover */ /* Icon animation on hover */
.practice-cards-wrapper:hover .practice-card:hover .practice-card-icon { .practice-card:hover .practice-card-icon {
transform: scale(1.05) rotate(3deg); transform: scale(1.05) rotate(3deg);
} }
@ -1790,13 +1825,13 @@
} }
/* Text animation on hover */ /* Text animation on hover */
.practice-cards-wrapper:hover .practice-card:hover h3 { .practice-card:hover h3 {
transform: translateY(-2px); transform: translateY(-2px);
} }
.practice-cards-wrapper:hover .practice-card:hover p, .practice-card:hover p,
.practice-cards-wrapper:hover .practice-card:hover .practice-meta-info, .practice-card:hover .practice-meta-info,
.practice-cards-wrapper:hover .practice-card:hover .practice-footer-text { .practice-card:hover .practice-footer-text {
transform: translateY(-1px); transform: translateY(-1px);
} }
@ -1840,8 +1875,8 @@
transform: translateY(-2px); transform: translateY(-2px);
} }
/* Show CTA button only on hovered card */ /* Show CTA button only on hovered card and first card by default */
.practice-cards-wrapper:hover .practice-card:hover .practice-cta-btn { .practice-card:hover .practice-cta-btn {
opacity: 1; opacity: 1;
transform: translateY(0); transform: translateY(0);
} }
@ -1864,30 +1899,6 @@
opacity: 1; opacity: 1;
} }
/* REMOVED: Default expanded state for first card */
/* Now all cards start equal and only expand on hover */
/* Show SVG and CTA button only on hover */
.practice-cards-wrapper .practice-card .practice-card-svg {
width: 0;
opacity: 0;
}
.practice-cards-wrapper .practice-card .practice-cta-btn {
opacity: 0;
transform: translateY(15px);
}
.practice-cards-wrapper:hover .practice-card:hover .practice-card-svg {
width: 35%;
opacity: 1;
}
.practice-cards-wrapper:hover .practice-card:hover .practice-cta-btn {
opacity: 1;
transform: translateY(0);
}
/* Mobile responsiveness */ /* Mobile responsiveness */
@media (max-width: 992px) { @media (max-width: 992px) {
.practice-cards-container { .practice-cards-container {
@ -1913,23 +1924,27 @@
border-radius: 12px 12px 0 0 !important; border-radius: 12px 12px 0 0 !important;
height: 120px; height: 120px;
flex: 1; flex: 1;
transform: none;
} }
.practice-card:last-child { .practice-card:last-child {
border-radius: 0 0 12px 12px !important; border-radius: 0 0 12px 12px !important;
} }
.practice-cards-wrapper:hover .practice-card:hover { .practice-card:hover {
height: 300px; height: 300px;
flex-direction: column; flex-direction: column;
} }
.practice-cards-wrapper:hover .practice-card:hover .practice-card-svg { .practice-card:hover .practice-card-svg {
width: 100%; width: 100%;
height: 120px; height: 120px;
} }
/* Mobile image styling */
.practice-card:hover .practice-card-svg img {
object-fit: cover; /* Better fit for mobile */
}
.practice-card-content { .practice-card-content {
min-width: auto; min-width: auto;
padding: 20px; padding: 20px;