add loading all page & change bugs

This commit is contained in:
Ehsan
2024-09-05 22:20:18 +03:30
parent 087ed4a818
commit c45a161fcb
72 changed files with 1208 additions and 661 deletions
+26 -14
View File
@@ -1,25 +1,37 @@
import CustomLoading from '@/app/component/loading/Custom';
import TextLoading from '@/app/component/loading/Text';
import Image from 'next/image'
import Link from 'next/link';
function Article({ data }) {
function Article({ data, loading }) {
return (
<li className='rounded-[8px] overflow-hidden bg-[#FFF] shadow-[0px_0px_41px_0px_rgba(173,_181,_189,_0.15)]'>
<Link href={`/blog/${data.id}`}>
<Image
className='w-full'
alt="article-img"
src={data.src}
height={217}
width={392}
/>
</Link>
<div className='p-[12px] md:p-[14px] lg:p-[16px]'>
<CustomLoading width='full' height={200} loading={loading}>
<Link href={`/blog/${data.id}`}>
<p className='text-[#3B3B3B] mb-[12px] md:mb-[14px] lg:mb-[16px] text-[16px] font-bold'>{data.title}</p>
<Image
className='w-full'
alt="article-img"
src={data.src}
height={217}
width={392}
/>
</Link>
</CustomLoading>
<div className='p-[12px] md:p-[14px] lg:p-[16px]'>
<div className={loading ? 'mb-[12px] md:mb-[14px] lg:mb-[16px]' : ''}>
<TextLoading width={150} height={18} loading={loading}>
<Link href={`/blog/${data.id}`}>
<p className='text-[#3B3B3B] mb-[12px] md:mb-[14px] lg:mb-[16px] text-[16px] font-bold'>{data.title}</p>
</Link>
</TextLoading>
</div>
<div className='flex items-center justify-start gap-[35px]'>
<p className='text-[#9B9B9B] text-[14px] font-medium'>تاریخ انتشار: {data.date_of_release}</p>
<p className='text-[#9B9B9B] text-[14px] font-medium'>زمان مطالعه: {data.time}</p>
<TextLoading width={100} height={18} loading={loading}>
<p className='text-[#9B9B9B] text-[14px] font-medium'>تاریخ انتشار: {data.date_of_release}</p>
</TextLoading>
<TextLoading width={110} height={18} loading={loading}>
<p className='text-[#9B9B9B] text-[14px] font-medium'>زمان مطالعه: {data.time}</p>
</TextLoading>
</div>
</div>
</li>
+2 -1
View File
@@ -2,7 +2,7 @@ import articles from '@/data/articles.json';
import Article from "./Article";
import Pagination from '@/app/component/Pagination';
function LatestArticles() {
function LatestArticles({ loading }) {
return (
<div>
<p className="text-[#3B3B3B] text-[20px] font-bold my-[16px] md:my-[20px] lg:my-[24px]">جدیدترین مقاله ها</p>
@@ -11,6 +11,7 @@ function LatestArticles() {
<Article
data={item}
key={item.id}
loading={loading}
/>
))}
</ul>