-
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 #432 from Studio-Yandex-Practicum/enhancement_426_…
…main_page_news enhancement_426_main_page_news
- Loading branch information
Showing
7 changed files
with
152 additions
and
111 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 './NewsCard' | ||
import NewsCard from './ui/NewsCard' | ||
export default NewsCard |
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,58 @@ | ||
@use '@/shared/styles/utils/variables' as var; | ||
@use '@/shared/styles/utils/mixins' as media; | ||
|
||
.newsCard { | ||
position: relative; | ||
display: flex; | ||
flex-direction: column; | ||
gap: 15px; | ||
width: 100%; | ||
overflow: hidden; | ||
|
||
@include media.respond-to('middle') { | ||
width: 260px; | ||
} | ||
} | ||
|
||
.image { | ||
width: 100%; | ||
height: 180px; | ||
border-radius: 10px; | ||
object-fit: cover; | ||
transition: 0.5s; | ||
} | ||
|
||
.noImage { | ||
width: 100%; | ||
max-width: 340px; | ||
height: 180px; | ||
object-fit: cover; | ||
padding: 20px; | ||
} | ||
|
||
.heading { | ||
line-height: 22px; | ||
font-size: 16px; | ||
font-weight: 500; | ||
transition: 0.5s; | ||
} | ||
|
||
.promo { | ||
position: absolute; | ||
top: 15px; | ||
left: 15px; | ||
background: var.$promo-color; | ||
border-radius: 5px; | ||
padding: 5px 10px; | ||
color: var.$white; | ||
font-size: 15px; | ||
font-weight: 700; | ||
} | ||
|
||
.newsCard:hover .heading { | ||
color: var.$link-color; | ||
} | ||
|
||
.newsCard:hover .image { | ||
transform: scale(1, 1.1); | ||
} |
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,35 @@ | ||
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 = () => { | ||
const image = 'https://gealit.ru/media/news/img-gallery-04-750x500.webp' | ||
const date = '2022-05-15' | ||
const title = 'Покупай и не жди. До -50% на весь электротранспорт!' | ||
|
||
return ( | ||
<div style={{ width: '340px' }}> | ||
<NewsCard id={1} image={image} date={date} title={title} link="#" /> | ||
</div> | ||
) | ||
} | ||
|
||
Default.args = { | ||
id: 1, | ||
image: 'http://gealit.ru/media/news/18.png', | ||
date: '2022-05-15', | ||
title: 'Покупай и не жди. До -50% на весь электротранспорт!', | ||
link: '#' | ||
} |
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