Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 41 additions & 37 deletions src/components/profile/Followers.jsx
Original file line number Diff line number Diff line change
@@ -1,63 +1,67 @@
import React from 'react';
import { CardDecorator } from '../design/CardDecorator';
import Link from 'next/link';
import Skeleton from 'react-loading-skeleton';
import { Tooltip } from 'react-tooltip';
import FriendCard from '../social/FriendCard';
import React from 'react'
import { CardDecorator } from '../design/CardDecorator'
import Link from 'next/link'
import Skeleton from 'react-loading-skeleton'
import { Tooltip } from 'react-tooltip'
import FriendCard from '../social/FriendCard'

const Followers = ({ followers, pageData, userData }) => {
const { user, ownUser } = userData;
const { setDisplayMode, page, totalPages, prevPage, nextPage } = pageData;
const { user, ownUser } = userData
const { setDisplayMode, page, totalPages, prevPage, nextPage } = pageData

return (
<>
<div className="bg-neutral-800 px-4 py-4 border-t-2 border-blue-600">
<div className="flex">
<div className='bg-neutral-800 px-4 py-4 border-t-2 border-blue-600'>
<div className='flex'>
<span>
<i
class="fas fa-angle-double-left mr-2 py-1.5 text-2xl text-white hover:text-gray-400"
class='fas fa-angle-double-left mr-2 py-1.5 text-2xl text-white hover:text-gray-400'
onClick={() => setDisplayMode('default')}
></i>
/>
</span>
<h1 className="mb-4 text-2xl font-bold uppercase text-white">
<h1 className='mb-4 text-2xl font-bold uppercase text-white'>
{user && user.username}'s Followers
</h1>
</div>

{followers.length>0 ? (
<div className="gap-4">
<div className="flex justify-center p-4">
<div className="grid max-w-7xl grid-cols-1 gap-1 md:grid-cols-2 lg:grid-cols-3">
{followers.length > 0 ? (
followers.map((follower, index) => (
<FriendCard key={index} data={follower} mutual={true} />
))
) : (
<p className="col-span-3 text-lg text-white">
You have no friends yet.
</p>
)}
{followers.length > 0
? (
<div className='gap-4'>
<div className='flex justify-center p-4'>
<div className='grid max-w-7xl grid-cols-1 gap-1 md:grid-cols-2 lg:grid-cols-3'>
{followers.length > 0
? (
followers.map((follower, index) => (
<FriendCard key={index} data={follower} mutual />
))
)
: (
<p className='col-span-3 text-lg text-white'>
You have no friends yet.
</p>
)}
</div>
</div>
</div>
</div>
) : (
<p className="text-neutral-400">No followers yet.</p>
)}
)
: (
<p className='text-neutral-400'>No followers yet.</p>
)}
{totalPages > 0 && (
<div className="flex items-center justify-center gap-x-5 py-4">
<div className='flex items-center justify-center gap-x-5 py-4'>
<button
onClick={prevPage}
className="w-24 rounded-sm bg-gray-800 px-4 py-2 font-bold text-white hover:bg-gray-700 disabled:opacity-50 "
className='w-24 rounded-sm bg-gray-800 px-4 py-2 font-bold text-white hover:bg-gray-700 disabled:opacity-50 '
disabled={page === 0}
>
Previous
</button>
<span className="text-white">
<span className='text-white'>
Page {page + 1} of {totalPages}
</span>
<button
onClick={nextPage}
className="w-24 rounded-sm bg-gray-800 px-4 py-2 font-bold text-white hover:bg-gray-700 disabled:opacity-50"
className='w-24 rounded-sm bg-gray-800 px-4 py-2 font-bold text-white hover:bg-gray-700 disabled:opacity-50'
disabled={page + 1 >= totalPages}
>
Next
Expand All @@ -66,7 +70,7 @@ const Followers = ({ followers, pageData, userData }) => {
)}
</div>
</>
);
};
)
}

export default Followers;
export default Followers
Loading