Skip to content

Commit fabded6

Browse files
authored
Merge pull request #345 from NOOB-3301/mainbackup3
added user following compoent
2 parents 6ae7287 + fb69de9 commit fabded6

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

front-end/src/pages/ProfilePage.jsx

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ import { motion, AnimatePresence } from 'framer-motion';
1717
import Markdown from 'react-markdown';
1818
import LikeButton from '../components/LikeButton';
1919

20+
const dummyFollowing = [
21+
{ id: 1, name: "User 1", image: "https://via.placeholder.com/50" },
22+
{ id: 2, name: "User 2", image: "https://via.placeholder.com/50" },
23+
{ id: 3, name: "User 2", image: "https://via.placeholder.com/50" },
24+
{ id: 4, name: "User 3", image: "https://via.placeholder.com/50" },
25+
{ id: 5, name: "User 4", image: "https://via.placeholder.com/50" }
26+
];
27+
28+
2029
const ProfilePage = () => {
2130
const [user, setUser] = useState({});
2231
const [userArticles, setUserArticles] = useState([]);
@@ -232,6 +241,50 @@ const ProfilePage = () => {
232241
</div>
233242
</div>
234243
</div>
244+
</div>
245+
<div className="bg-white mt-10 dark:bg-gray-800 rounded-xl shadow-sm hover:shadow-lg transition-all duration-300 p-6">
246+
<h3 className="text-lg font-semibold text-gray-800 dark:text-white mb-6 flex items-center gap-2">
247+
<ChartBarIcon className="w-5 h-5 text-indigo-600" />
248+
You Following:
249+
</h3>
250+
<motion.div
251+
className="space-y-4 p-4 bg-white shadow-md rounded-lg"
252+
initial={{ opacity: 0, y: 20 }}
253+
animate={{ opacity: 1, y: 0 }}
254+
transition={{ duration: 0.5, ease: "easeOut" }}
255+
>
256+
<h2 className="text-lg font-semibold text-blue-600">You are following:</h2>
257+
258+
{user.following && user.following.length > 0 ? (
259+
<motion.ul className="space-y-2">
260+
{user.following.map((followedUser) => (
261+
<motion.li
262+
key={followedUser.id}
263+
className="flex items-center space-x-3 p-3 border rounded-lg hover:bg-gray-100 transition duration-200"
264+
whileHover={{ scale: 1.05 }}
265+
>
266+
<img src={followedUser.image} alt={followedUser.name} className="w-12 h-12 rounded-full border-2 border-blue-500" />
267+
<span className="font-medium text-gray-800">{followedUser.name}</span>
268+
</motion.li>
269+
))}
270+
</motion.ul>
271+
) : (
272+
<motion.ul className="space-y-2 text-gray-500">
273+
{dummyFollowing.map((user) => (
274+
<motion.li
275+
key={user.id}
276+
className="flex items-center space-x-3 p-3 border rounded-lg hover:bg-gray-100 transition duration-200"
277+
whileHover={{ scale: 1.05 }}
278+
>
279+
<img src={user.image} alt={user.name} className="w-12 h-12 rounded-full border-2 border-gray-400" />
280+
<span className="font-medium text-gray-700">{user.name}</span>
281+
</motion.li>
282+
))}
283+
</motion.ul>
284+
)}
285+
</motion.div>
286+
287+
235288
</div>
236289

237290
{/* Additional Sections */}

0 commit comments

Comments
 (0)