-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #394 from Studio-Yandex-Practicum/enhancement-309-…
…main-skeleton skeletonNewsBlock
- Loading branch information
Showing
13 changed files
with
206 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
@use '@/app/styles/index' as var; | ||
|
||
.card { | ||
width: 340px; | ||
position: relative; | ||
transition: transform 0.3s ease-in-out; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
gap: 15px; | ||
|
||
&:hover { | ||
transform: scale(1.1, 1.05); | ||
transition: transform 0.3s ease-in-out; | ||
} | ||
|
||
.heading { | ||
font-size: #{'min(max(14px, 1.2vw), 16px)'}; | ||
} | ||
|
||
&:hover .heading { | ||
color: var.$link-color; | ||
} | ||
|
||
span { | ||
color: var.$body-color-light-grey; | ||
} | ||
|
||
.promo { | ||
display: inline-block; | ||
position: absolute; | ||
top: 15px; | ||
left: 15px; | ||
background: var.$promo-color; | ||
border-radius: 5px; | ||
padding: 5px 10px; | ||
color: var.$white; | ||
font-size: 15px; | ||
line-height: 120%; | ||
font-weight: 500; | ||
} | ||
|
||
.img { | ||
height: 180px; | ||
width: 100%; | ||
border-radius: 6px; | ||
transition: transform 0.3s ease-in-out; | ||
scroll-snap-align: start; | ||
object-fit: cover; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
|
||
import NewsCard from './NewsCard' | ||
|
||
const meta = { | ||
title: 'entities/NewsCard', | ||
component: NewsCard, | ||
parameters: { | ||
layout: 'centered' | ||
}, | ||
tags: ['autodocs'] | ||
} satisfies Meta<typeof NewsCard> | ||
|
||
export default meta | ||
type Story = StoryObj<typeof meta> | ||
|
||
export const Default: Story = { | ||
args: { | ||
id: 1, | ||
image: 'http://gealit.ru/media/news/18.png', | ||
title: 'Покупай и не жди. До -50% на весь электротранспорт!', | ||
date: '2022-05-15' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
import NewsCard from './ui/NewsCard' | ||
import NewsCard from './NewsCard' | ||
export default NewsCard |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
src/widgets/NewsBlock/NewsBlockSkeleton/NewsBlockSkeleton.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
19
src/widgets/NewsBlock/NewsBlockSkeleton/NewsBlockSkeleton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/widgets/StoriesBlock/StoriesBlockSkeleton/StoriesBlockSkeleton.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.skeletonNewsCard { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
width: 160px; | ||
height: 100%; | ||
background-color: #f0f0f0; | ||
border-radius: 8px; | ||
overflow: hidden; | ||
margin:0; | ||
} | ||
|
||
|
Oops, something went wrong.