-
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 #205 from Studio-Yandex-Practicum/enhancement-200-…
…change-StoriesBlock-to-fsd #200-enhancement-changed-StoriesBlock-to-fsd
- Loading branch information
Showing
7 changed files
with
171 additions
and
1 deletion.
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,21 @@ | ||
@use '@/app/styles/index' as var; | ||
|
||
.card { | ||
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; | ||
} | ||
} |
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,25 @@ | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
import StoryCard from './StoryCard' | ||
import Img1 from '@/assets/images/stories/img-stories-01.png' | ||
|
||
const meta = { | ||
title: 'entities/StoryCard', | ||
component: StoryCard, | ||
parameters: { | ||
layout: 'centered' | ||
}, | ||
tags: ['autodocs'] | ||
} satisfies Meta<typeof StoryCard> | ||
|
||
export default meta | ||
type Story = StoryObj<typeof meta> | ||
|
||
export const Default: Story = { | ||
args: { | ||
card: { | ||
id: 1, | ||
src: Img1, | ||
alt: 'Stock image' | ||
} | ||
} | ||
} |
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,23 @@ | ||
import { FC } from 'react' | ||
import { TCard } from '@/models/CardModel' | ||
import styles from './StoryCard.module.scss' | ||
import Link from '@/shared/ui/Link/Link' | ||
|
||
export type Props = { | ||
card: TCard | ||
} | ||
|
||
/** | ||
* Карточка из блока группы историй | ||
* @param {TCard} card - параметры карточки из группы историй | ||
*/ | ||
|
||
const StoryCard: FC<Props> = ({ card }) => { | ||
return ( | ||
<Link to={''} className={styles.card}> | ||
<img src={card.src} alt={card.alt} draggable="false" /> | ||
</Link> | ||
) | ||
} | ||
|
||
export default StoryCard |
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,48 @@ | ||
@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; | ||
} | ||
|
||
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 { FC } from 'react' | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
import styles from './StoriesBlock.module.scss' | ||
import StoriesBlock from './StoriesBlock' | ||
|
||
const StorybookWrapper: FC = () => { | ||
return ( | ||
<div className={styles.storybook}> | ||
<StoriesBlock /> | ||
</div> | ||
) | ||
} | ||
|
||
const meta = { | ||
title: 'widgets/StoriesBlock', | ||
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,26 @@ | ||
import { FC } from 'react' | ||
import Heading, { HeadingType } from '@/shared/ui/Heading/Heading' | ||
import styles from './StoriesBlock.module.scss' | ||
import Scroll from '@/shared/ui/Scroll/Scroll' | ||
import { storiesData } from '@/mockData/storiesData' | ||
import StoryCard from '@/entities/StoryCard/StoryCard' | ||
|
||
/** | ||
* Блок группы историй | ||
*/ | ||
const StoriesBlock: FC = () => { | ||
return ( | ||
<section className={styles.wrapper}> | ||
<article> | ||
<Heading type={HeadingType.NORMAL}>Истории</Heading> | ||
</article> | ||
<Scroll> | ||
{storiesData.map(item => ( | ||
<StoryCard key={item.id} card={item} /> | ||
))} | ||
</Scroll> | ||
</section> | ||
) | ||
} | ||
|
||
export default StoriesBlock |