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

skeletonNewsBlock #394

Merged
merged 32 commits into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5617fe4
Добавил надпись об отсутствии товаров в избранном
kirill-k88 May 16, 2024
5c70b92
Заменил мокавыве данные в корзине в шапке на реальные данные из слайс…
kirill-k88 May 17, 2024
1b98ec4
enhancement_377_login_form_adaptive_new
AlexanderMorugin May 17, 2024
f5fbbd2
Merge branch 'master' into enhancement_381_favorite_page
kirill-k88 May 18, 2024
08d5067
skeletonNewsBlock
May 20, 2024
18adcf3
Merge pull request #392 from Studio-Yandex-Practicum/enhancement_377_…
AlexanderMorugin May 21, 2024
403a902
Merge pull request #391 from Studio-Yandex-Practicum/bag_386_header
kirill-k88 May 21, 2024
7c27885
Merge pull request #393 from Studio-Yandex-Practicum/enhancement_381_…
kirill-k88 May 21, 2024
9b51623
enhancement_350_adaptive_main_page
AlexanderMorugin May 22, 2024
a03704a
enhancement_350_adaptive_main_page
AlexanderMorugin May 22, 2024
9740436
step-2 enhancement_350_adaptive_main_page
AlexanderMorugin May 22, 2024
bc22043
#360-enhancement-create-Create-Account-Page
JuliaAvramenko May 23, 2024
bfc0650
fix-ReviewBlock enhancement_350_adaptive_main_page
AlexanderMorugin May 23, 2024
62bd790
fix-CategoryGrid enhancement_350_adaptive_main_page
AlexanderMorugin May 23, 2024
27e4a64
fix-HeroBlock enhancement_350_adaptive_main_page
AlexanderMorugin May 23, 2024
f389c8e
fix after review-1 enhancement_350_adaptive_main_page
AlexanderMorugin May 24, 2024
2c54226
fix-Advantages enhancement_350_adaptive_main_page
AlexanderMorugin May 24, 2024
499c4a2
fix-NewsBlock enhancement_350_adaptive_main_page
AlexanderMorugin May 24, 2024
56a46a4
fix-StoriesBlock enhancement_350_adaptive_main_page
AlexanderMorugin May 25, 2024
5a7ee33
fix-BannerBlock enhancement_350_adaptive_main_page
AlexanderMorugin May 25, 2024
d614f97
fix-BrandBlock enhancement_350_adaptive_main_page
AlexanderMorugin May 26, 2024
306fe67
fix-BlogBlock enhancement_350_adaptive_main_page
AlexanderMorugin May 26, 2024
2cbf2af
Merge pull request #397 from Studio-Yandex-Practicum/enhancement-360-…
JuliaAvramenko May 27, 2024
24326f1
fix-after-review-2 enhancement_350_adaptive_main_page
AlexanderMorugin May 27, 2024
b3111e7
Merge pull request #396 from Studio-Yandex-Practicum/enhancement_350_…
AlexanderMorugin May 28, 2024
3c6e299
skeletonNewsBlock
May 20, 2024
55f5095
enhancement-newsBlock-skeleton
Jun 2, 2024
044bd3c
skeleton-StoriesBlock
Jun 2, 2024
35e115c
Resolved merge conflict in NewsBlock.tsx
Jun 2, 2024
c6df98b
StoriesBlockSkeleton, StoriesBlock & styles
Jun 6, 2024
29fc04c
style
Jun 12, 2024
46e430e
style StoriesBlockSkeleton
Jun 13, 2024
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.skeletonNewsCard {
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
background-color: #f0f0f0;
border-radius: 8px;
overflow: hidden;
margin-bottom: 16px;
}

.content {
padding: 16px;
}

.content > div {
margin-bottom: 8px;
}

19 changes: 19 additions & 0 deletions src/widgets/NewsBlock/NewsBlockSkeleton/NewsBlockSkeleton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { FC } from 'react'
import Skeleton from 'react-loading-skeleton'
import 'react-loading-skeleton/dist/skeleton.css'

import styles from './NewsBlockSkeleton.module.scss'

const NewsBlockSkeleton: FC = () => {
return (
<div className={styles.skeletonNewsCard}>
<Skeleton height={180} />
<div className={styles.content}>
<Skeleton width={`60%`} />
<Skeleton width={`80%`} />
</div>
</div>
)
}

export default NewsBlockSkeleton
15 changes: 12 additions & 3 deletions src/widgets/NewsBlock/ui/NewsBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Scroll from '@/shared/ui/Scroll/Scroll'
import { getShopNewsSelector } from '../model/selectors/selectors'
import { getShopNews } from '../model/services/getShopNews'
import { ShopNewsData } from '../model/types/types'
import NewsBlockSkeleton from '../NewsBlockSkeleton/NewsBlockSkeleton'

import styles from './NewsBlock.module.scss'

Expand All @@ -36,9 +37,17 @@ const NewsBlock: FC = () => {
</Link>
</article>
<Scroll>
{news.map(item => (
<NewsCard key={item.id} id={item.id} image={item.image} date={item.pub_date} title={item.title} />
))}
{news.length === 0
? Array.from({ length: 5 }).map((_, index) => <NewsBlockSkeleton key={index} />)
: news.map(item => (
<NewsCard
key={item.id}
id={item.id}
image={item.image}
date={item.pub_date}
title={item.title}
/>
))}
</Scroll>
</section>
)
Expand Down
Loading