chore: added project and updates to UI

This commit is contained in:
Harivansh Rathi 2025-03-18 18:39:43 -04:00
parent 4ffb2ffc07
commit e80ece7300
13 changed files with 513 additions and 92 deletions

View file

@ -6,6 +6,9 @@ import { dataportfolio, meta } from "../../content_option";
import { FaExternalLinkAlt } from "react-icons/fa";
export const Portfolio = () => {
// Check if the device is mobile
const isMobile = window.innerWidth <= 768;
return (
<HelmetProvider>
<Container className="About-header">
@ -22,17 +25,26 @@ export const Portfolio = () => {
</Row>
<div className="mb-5 project_items_ho">
{dataportfolio.map((data, i) => {
const title = data.description.split(",")[0];
// Extract title and description without modifying for desktop
const fullTitle = data.description.split(",")[0];
const description = data.description.split(",").slice(1).join(",").trim();
// Create shortened version only for mobile display
const words = fullTitle.split(" ");
const shortTitle = words.length > 3
? words.slice(0, 3).join(" ") + "..."
: fullTitle;
return (
<div key={i} className="project_item">
<img src={data.img} alt={title} />
<img src={data.img} alt={fullTitle} />
<div className="content">
<h3>{title}</h3>
<h3>{fullTitle}</h3>
<p>{description}</p>
<a href={data.link} target="_blank" rel="noopener noreferrer">
View Project <FaExternalLinkAlt size={14} />
<a href={data.link} target="_blank" rel="noopener noreferrer" className="project-link">
<span className="desktop-text">View Project</span>
<span className="mobile-text">{shortTitle}</span>
<FaExternalLinkAlt size={14} />
</a>
</div>
</div>

View file

@ -92,6 +92,7 @@
-moz-osx-font-smoothing: grayscale;
}
/* Desktop styles for links */
.project_item .content a {
color: var(--text-color);
text-decoration: none;
@ -109,6 +110,11 @@
border: 1px solid var(--card-border);
}
/* Hide mobile text by default on desktop */
.mobile-text {
display: none;
}
.project_item .content a:hover {
background: var(--secondary-color);
color: var(--primary-color);
@ -116,7 +122,7 @@
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}
/* Mobile Styles */
/* Mobile Styles - Only apply below 768px */
@media (max-width: 768px) {
.project_items_ho {
gap: 1.5rem;
@ -134,52 +140,42 @@
.project_item .content {
opacity: 1;
padding: 1.25rem;
background: linear-gradient(
to top,
rgba(var(--primary-rgb), 0.95) 0%,
rgba(var(--primary-rgb), 0.7) 50%,
rgba(var(--primary-rgb), 0.3) 100%
);
background: transparent;
justify-content: flex-end;
gap: 0.75rem;
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
backdrop-filter: none;
-webkit-backdrop-filter: none;
border-top: 1px solid var(--card-border);
}
.project_item .content h3 {
font-size: 1.1rem;
margin-bottom: 0.5rem;
padding-bottom: 0.25rem;
width: 100%;
max-width: 100%;
overflow-wrap: break-word;
word-wrap: break-word;
-webkit-hyphens: auto;
hyphens: auto;
display: none; /* Hide title on mobile */
}
.project_item .content p {
font-size: 0.9rem;
margin-bottom: 1rem;
line-height: 1.4;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
display: none; /* Hide description text on mobile */
}
/* Show mobile text and hide desktop text on mobile */
.mobile-text {
display: inline;
white-space: nowrap;
overflow: hidden;
width: 100%;
max-width: 100%;
overflow-wrap: break-word;
word-wrap: break-word;
-webkit-hyphens: auto;
hyphens: auto;
text-overflow: ellipsis;
max-width: calc(100% - 20px); /* Allow space for the icon */
}
.desktop-text {
display: none;
}
.project_item .content a {
padding: 0.75rem 1.25rem;
font-size: 0.9rem;
border-radius: 6px;
background: var(--primary-color);
background: rgba(var(--primary-rgb), 0.7);
backdrop-filter: blur(5px);
-webkit-backdrop-filter: blur(5px);
width: 100%;
text-align: center;
justify-content: center;
@ -189,6 +185,10 @@
appearance: none;
position: relative;
z-index: 1;
margin-top: 0; /* Remove margin since title is hidden */
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
height: 45px; /* Fix height to prevent expansion */
overflow: hidden;
}
.project_item:active {