-
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.
#199-enhancement-changed-BlogBlock-to-fsd
- Loading branch information
1 parent
5367826
commit e32cda2
Showing
9 changed files
with
226 additions
and
16 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,36 @@ | ||
@use '@/app/styles/index' as var; | ||
|
||
.card { | ||
min-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; | ||
} | ||
|
||
img { | ||
border-radius: 6px; | ||
transition: transform 0.3s ease-in-out; | ||
scroll-snap-align: start; | ||
} | ||
|
||
.heading | ||
{ | ||
font-size: #{'min(max(14px, 1.2vw), 16px)'}; | ||
} | ||
|
||
&:hover .heading { | ||
color: var.$link-color; | ||
} | ||
|
||
span { | ||
color: var.$body-color-light-grey; | ||
} | ||
|
||
} |
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,27 @@ | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
import BlogCard from './BlogCard' | ||
import Img1 from '@/assets/images/blog/img-blog-01.png' | ||
|
||
const meta = { | ||
title: 'entities/BlogCard', | ||
component: BlogCard, | ||
parameters: { | ||
layout: 'centered' | ||
}, | ||
tags: ['autodocs'] | ||
} satisfies Meta<typeof BlogCard> | ||
|
||
export default meta | ||
type Story = StoryObj<typeof meta> | ||
|
||
export const Default: Story = { | ||
args: { | ||
card: { | ||
id: 1, | ||
src: Img1, | ||
alt: 'Покупай и не жди. До -50% на весь электротранспорт!', | ||
title: 'Покупай и не жди. До -50% на весь электротранспорт!', | ||
date: '8 Мая, 2022' | ||
} | ||
} | ||
} |
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,28 @@ | ||
import { FC } from 'react' | ||
import { TCard } from '@/models/CardModel' | ||
import styles from './BlogCard.module.scss' | ||
import Link from '@/shared/ui/Link/Link' | ||
import Heading, { HeadingType } from '@/shared/ui/Heading/Heading' | ||
|
||
export type Props = { | ||
card: TCard | ||
} | ||
|
||
/** | ||
* Карточка из блока блог | ||
* @param {TCard} card - параметры карточки из блога | ||
*/ | ||
|
||
const BlogCard: FC<Props> = ({ card }) => { | ||
return ( | ||
<Link to={''} className={styles.card}> | ||
<img src={card.src} alt={card.alt} draggable="false" /> | ||
<Heading type={HeadingType.NORMAL} className={styles.heading}> | ||
{card.title} | ||
</Heading> | ||
<span>{card.date}</span> | ||
</Link> | ||
) | ||
} | ||
|
||
export default BlogCard |
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
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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
@use '@/app/styles/index' as var; | ||
|
||
.storybook { | ||
width: 1080px; | ||
} | ||
|
||
.wrapper { | ||
width: 100%; | ||
margin: 0 auto; | ||
display: flex; | ||
flex-direction: column; | ||
gap: 18px; | ||
|
||
h2 { | ||
font-size: #{'min(max(18px, 1.6vw), 20px)'}; | ||
line-height: 115%; | ||
font-weight: 500; | ||
} | ||
|
||
article { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: flex-end; | ||
padding: 0 10px; | ||
} | ||
|
||
.link { | ||
font-size: 15px; | ||
line-height: 120%; | ||
font-weight: 500; | ||
|
||
&:hover { | ||
opacity: 0.7; | ||
} | ||
} | ||
|
||
.svg { | ||
width: 1.25rem; | ||
height: 0.5625rem; | ||
margin-left: 0.5rem; | ||
vertical-align: middle; | ||
} | ||
|
||
ul { | ||
display: flex; | ||
gap: 20px; | ||
padding: 0 10px 20px; | ||
overflow: auto hidden; | ||
cursor: grab; | ||
|
||
&::-webkit-scrollbar { | ||
height: 3px; | ||
} | ||
|
||
&::-webkit-scrollbar-thumb { | ||
background: var.$theme-primary-color; | ||
cursor: grab; | ||
} | ||
|
||
&::-webkit-scrollbar-track { | ||
margin-left: 10px; | ||
margin-right: 10px; | ||
} | ||
} | ||
} |
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,26 @@ | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
import styles from './BlogBlock.module.scss' | ||
import { FC } from 'react' | ||
import BlogBlock from './BlogBlock' | ||
|
||
const StorybookWrapper: FC = () => { | ||
return ( | ||
<div className={styles.storybook}> | ||
<BlogBlock /> | ||
</div> | ||
) | ||
} | ||
|
||
const meta = { | ||
title: 'widgets/BlogBlock', | ||
component: StorybookWrapper, | ||
parameters: { | ||
layout: 'centered' | ||
}, | ||
tags: ['autodocs'] | ||
} satisfies Meta<typeof StorybookWrapper> | ||
|
||
export default meta | ||
type Story = StoryObj<typeof meta> | ||
|
||
export const Default: Story = {} |
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,33 @@ | ||
import { FC } from 'react' | ||
import IconLink from '@/assets/icons/IconLink' | ||
import Heading, { HeadingType } from '@/shared/ui/Heading/Heading' | ||
import Link from '@/shared/ui/Link/Link' | ||
import styles from './BlogBlock.module.scss' | ||
import Scroll from '@/shared/ui/Scroll/Scroll' | ||
import { blogData } from '@/mockData/blogData' | ||
import BlogCard from '@/entities/BlogCard/BlogCard' | ||
|
||
/** | ||
* Блок группы карточек блога | ||
*/ | ||
|
||
const BlogBlock: FC = () => { | ||
return ( | ||
<section className={styles.wrapper}> | ||
<article> | ||
<Heading type={HeadingType.NORMAL}>Блог</Heading> | ||
<Link to={'#'} className={styles.link}> | ||
Показать все | ||
<IconLink styles={styles.svg}></IconLink> | ||
</Link> | ||
</article> | ||
<Scroll> | ||
{blogData.map(item => ( | ||
<BlogCard key={item.id} card={item} /> | ||
))} | ||
</Scroll> | ||
</section> | ||
) | ||
} | ||
|
||
export default BlogBlock |