Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loader At MemberPage #256

Merged
merged 1 commit into from
Apr 18, 2024
Merged
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
8 changes: 7 additions & 1 deletion app/[locale]/members/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { useTranslations } from 'next-intl';
import useTextDirection from '@/hooks/useTextDirection';
import Magnifier from '@/components/SvgCmps/Magnifier';
import classNames from 'classnames';
import MemberCardLoader from '@/components/Members/MemberCard/memberCardLoader/MemberCardLoader';

const WelcomeMessage = () => {
const t = useTranslations('Members');
Expand Down Expand Up @@ -79,7 +80,12 @@ const MembersPage: React.FC<{}> = ({}) => {
/>
</div>
</div>
<MembersList members={members} />

{members.length > 0 ? (
<MembersList members={members} />
) : (
<MemberCardLoader memberCardNum={6} />
)}
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react';

function MemberCardInfoLoader() {
return (
<div className="flex w-full ">
<div className="flex flex-col rounded-md p-[10px] pr-6 w-full gap-2">
<div className="flex gap-4">
<div className="h-[40px] w-[40px] rounded-full bg-slate-300 animate-pulse"></div>
<div className="titles-container block pt-1 ">
<div className="flex flex-col gap-2 ">
<div className="h-4 w-20 rounded-lg bg-slate-300 animate-pulse "></div>
<div className="h-4 w-32 rounded-lg bg-slate-300 animate-pulse "></div>
</div>
</div>
</div>
<div className="h-[6dvh] w-full rounded-md bg-slate-300 animate-pulse p-1 mt-2 ">
{' '}
</div>
<div className="h-4 w-32 rounded-lg bg-slate-300 animate-pulse "></div>
</div>
<div className="flex flex-col w-[67px] bg-purple-200 justify-evenly items-center dark:bg-gray-800 rounded-tl-2xl rounded-bl-2xl shadow-2xl">
<div className="h-[35px] w-[35px] rounded-full bg-slate-400 animate-pulse"></div>
<div className="h-[35px] w-[35px] rounded-full bg-slate-400 animate-pulse"></div>
<div className="h-[35px] w-[35px] rounded-full bg-slate-400 animate-pulse"></div>
</div>
</div>
);
}

export default MemberCardInfoLoader;
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import MemberCardInfoLoader from './MemberCardInfoLoader';

const MemberCardLoader = ({ memberCardNum }: { memberCardNum: number }) => {
const duplicateLogic = Array.from({ length: memberCardNum }, (_, index) => {
return (
<div
key={index}
className="flex bg-purple-100 dark:bg-gray-600 rounded-2xl shadow-md w-full xl:w-[400px] xl:h-[173px]"
>
<MemberCardInfoLoader />
</div>
);
});
return (
<div className="flex mx-auto w-[90%] flex-wrap gap-4 mt-6 justify-between">
{duplicateLogic}
</div>
);
};

export default MemberCardLoader;
Loading