Skip to content

Commit 7e13461

Browse files
committed
Refactor Navbar component to accept onOpenModal prop and update styling; enhance PortfolioIdeas modal title for clarity
1 parent 5bc9c19 commit 7e13461

1 file changed

Lines changed: 126 additions & 52 deletions

File tree

src/Page/PortfolioIdeas/PortfolioIdeas.jsx

Lines changed: 126 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,29 @@ import React, { useState, useEffect } from 'react';
22
import { Footer } from '../../components/Footer/Footer';
33
import portfoliosData from './portfolio.json'; // Import the JSON file
44
import styled from 'styled-components';
5-
6-
const Navbar = () => {
7-
return (
8-
<nav className="sticky top-0 z-50 w-full bg-gray-800 text-white shadow-md">
9-
<div className="mx-auto flex max-w-7xl items-center justify-between px-4 py-3">
10-
<a href="/home">
11-
<button className="flex items-center gap-2 rounded-full border border-white p-2 hover:bg-gray-700">
12-
<svg className="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
13-
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 19l-7-7 7-7" />
14-
</svg>
15-
<span className="hidden md:inline">Back</span>
16-
</button>
17-
</a>
18-
<div className="text-2xl font-bold">
19-
<img src="./DevDisplay ICON.png" alt="DevDisplay" className="h-12 w-12" />
20-
</div>
5+
import { ArrowLeft } from 'lucide-react';
6+
7+
const Navbar = ({ onOpenModal }) => (
8+
<nav className="sticky top-0 z-50 w-full bg-gray-900 text-white shadow-md">
9+
<div className="mx-auto flex max-w-7xl items-center justify-between px-2 py-3">
10+
<a href="/">
11+
<button className="flex items-center gap-2 rounded-full border border-white p-2 hover:bg-gray-700">
12+
<ArrowLeft className="h-5 w-5" />
13+
<span className="hidden md:inline">Back</span>
14+
</button>
15+
</a>
16+
<div className="flex items-center justify-center">
17+
<StyledButton onClick={onOpenModal}>
18+
<div className="blob1" />
19+
<div className="inner">Add Your Portfolio!</div>
20+
</StyledButton>
2121
</div>
22-
</nav>
23-
);
24-
};
22+
<div className="text-2xl font-bold">
23+
<img src="./DevDisplay ICON.png" alt="DevDisplay" className="h-12 w-12" />
24+
</div>
25+
</div>
26+
</nav>
27+
);
2528

2629
const StyledWrapper = styled.div`
2730
.relative {
@@ -336,18 +339,105 @@ const VoteButton = styled.button`
336339
}
337340
`;
338341

339-
const PortfolioIdeas = () => {
340-
const [isModalOpen, setIsModalOpen] = useState(false);
342+
const StyledButton = styled.button`
343+
cursor: pointer;
344+
font-size: 1rem;
345+
border-radius: 12px;
346+
border: none;
347+
padding: 1px;
348+
background: radial-gradient(circle 80px at 80% -10%, #ffffff, #181b1b);
349+
position: relative;
350+
transition:
351+
background 0.3s,
352+
transform 0.3s;
353+
animation: zoom 3s ease-in-out infinite;
354+
margin-top: 16px;
355+
356+
&:hover {
357+
transform: scale(0.98);
358+
animation-play-state: paused;
359+
}
360+
361+
&::after {
362+
content: '';
363+
position: absolute;
364+
width: 65%;
365+
height: 60%;
366+
border-radius: 120px;
367+
top: 0;
368+
right: 0;
369+
box-shadow: 0 0 20px #ffffff38;
370+
z-index: -1;
371+
transition: box-shadow 0.3s;
372+
}
373+
374+
&:hover::after {
375+
box-shadow: 0 0 10px #ffffff18;
376+
}
377+
378+
.blob1 {
379+
position: absolute;
380+
width: 50px;
381+
height: 100%;
382+
border-radius: 16px;
383+
bottom: 0;
384+
left: 0;
385+
background: radial-gradient(circle 60px at 0% 100%, #3fe9ff, #0000ff80, transparent);
386+
box-shadow: -10px 10px 30px #0051ff2d;
387+
transition:
388+
background 0.3s,
389+
box-shadow 0.3s;
390+
}
391+
392+
&:hover .blob1 {
393+
box-shadow: -5px 5px 20px #000;
394+
}
395+
396+
.inner {
397+
padding: 10px 20px;
398+
border-radius: 12px;
399+
color: #fff;
400+
z-index: 3;
401+
position: relative;
402+
background: radial-gradient(circle 80px at 80% -50%, #777777, #0f1111);
403+
transition: background 0.3s;
404+
}
405+
406+
&:hover .inner {
407+
background: radial-gradient(circle 80px at 80% -50%, #333333, #0f0f0f);
408+
}
409+
410+
.inner::before {
411+
content: '';
412+
width: 100%;
413+
height: 100%;
414+
left: 0;
415+
top: 0;
416+
border-radius: 12px;
417+
background: radial-gradient(circle 60px at 0% 100%, #00e1ff1a, #0000ff11, transparent);
418+
position: absolute;
419+
transition: opacity 0.3s;
420+
}
421+
422+
&:hover .inner::before {
423+
opacity: 0;
424+
}
425+
426+
@keyframes zoom {
427+
0%,
428+
100% {
429+
transform: scale(1);
430+
}
431+
50% {
432+
transform: scale(1.05);
433+
}
434+
}
435+
`;
436+
437+
const PortfolioIdeas = ({ isModalOpen, setIsModalOpen }) => {
341438
const [portfolios, setPortfolios] = useState([]);
342439
const [searchTerm, setSearchTerm] = useState('');
343440
const [votes, setVotes] = useState({});
344-
const [newPortfolio, setNewPortfolio] = useState({
345-
author: '',
346-
screenshot: '',
347-
liveUrl: '',
348-
repo: '',
349-
techStack: '',
350-
});
351441

352442
useEffect(() => {
353443
const shuffledPortfolios = shuffleArray(portfoliosData); // Shuffle portfolios
@@ -364,27 +454,14 @@ const PortfolioIdeas = () => {
364454
localStorage.setItem('portfolioVotes', JSON.stringify(newVotes));
365455
};
366456

367-
const handleSubmit = (e) => {
368-
e.preventDefault();
369-
setPortfolios([...portfolios, newPortfolio]);
370-
setNewPortfolio({
371-
author: '',
372-
screenshot: '',
373-
liveUrl: '',
374-
repo: '',
375-
techStack: '',
376-
});
377-
setIsModalOpen(false);
378-
};
379-
380457
const filteredPortfolios = portfolios.filter((portfolio) =>
381458
portfolio.author.toLowerCase().includes(searchTerm.toLowerCase()),
382459
);
383460

384461
return (
385462
<div className="p-6">
386463
<div className="flex w-full flex-col items-center justify-center px-8 text-center">
387-
<div className="my-0"></div>
464+
<div className="my-4"></div>
388465
<StyledWrapper>
389466
<div className="modgp relative inline-block w-full py-3">
390467
<div className="relative">
@@ -587,24 +664,19 @@ const PortfolioIdeas = () => {
587664
</div>
588665
</div>
589666
</StyledWrapper>
667+
<div className="my-6"></div>
590668
</div>
591-
<div className="mb-8 flex items-center justify-between">
669+
<div className="mb-8 flex justify-center">
592670
<div className="w-64">
593671
<SearchBar onSearch={setSearchTerm} />
594672
</div>
595-
<button
596-
onClick={() => setIsModalOpen(true)}
597-
className="rounded-lg bg-[#00a6fb] px-4 py-2 text-white transition-colors hover:bg-[#0089d2]"
598-
>
599-
Add Your Portfolio
600-
</button>
601673
</div>
602674

603675
{isModalOpen && (
604676
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-50">
605677
<div className="w-full max-w-md rounded-lg bg-gray-800 p-6 text-white">
606678
<div className="mb-4 flex items-center justify-between">
607-
<h2 className="text-xl font-semibold">Add Your Portfolio</h2>
679+
<h2 className="text-xl font-semibold">Spotlight Your Portfolio Globally!</h2>
608680
<button onClick={() => setIsModalOpen(false)} className="text-gray-400 hover:text-white">
609681
X
610682
</button>
@@ -686,11 +758,13 @@ const PortfolioIdeas = () => {
686758
};
687759

688760
const ProjectsPage = () => {
761+
const [isModalOpen, setIsModalOpen] = useState(false);
762+
689763
return (
690764
<div className="background-wrapper1 flex min-h-screen flex-col bg-gray-900">
691-
<Navbar />
765+
<Navbar onOpenModal={() => setIsModalOpen(true)} />
692766
<div className="flex-grow">
693-
<PortfolioIdeas />
767+
<PortfolioIdeas isModalOpen={isModalOpen} setIsModalOpen={setIsModalOpen} />
694768
</div>
695769
<Footer />
696770
</div>

0 commit comments

Comments
 (0)