-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: fix wrapperRef for loading articles on scroll, add sticky filters
- Loading branch information
Showing
9 changed files
with
1,036 additions
and
867 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
src/pages/ArticlesPage/ui/ArticlesPage/ArticlesPage.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,7 @@ | ||
.ArticlesPage { | ||
min-height: 100%; | ||
|
||
.list { | ||
margin-top: 30px; | ||
} | ||
} |
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
28 changes: 28 additions & 0 deletions
28
src/shared/layouts/StickyContentLayout/StickyContentLayout.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,28 @@ | ||
.MainLayout { | ||
display: grid; | ||
grid-template-areas: "left content right"; | ||
grid-template-columns: min-content 1fr min-content; | ||
} | ||
|
||
.left { | ||
grid-area: left; | ||
} | ||
|
||
.content { | ||
grid-area: content; | ||
max-width: 1200px; | ||
justify-self: center; | ||
padding: 0 16px; | ||
width: 100%; | ||
} | ||
|
||
.right { | ||
grid-area: right; | ||
} | ||
|
||
.left, | ||
.right { | ||
position: sticky; | ||
top: 32px; | ||
height: fit-content; | ||
} |
24 changes: 24 additions & 0 deletions
24
src/shared/layouts/StickyContentLayout/StickyContentLayout.stories.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,24 @@ | ||
import React from 'react'; | ||
import { ComponentStory, ComponentMeta } from '@storybook/react'; | ||
|
||
import { StickyContentLayout } from './StickyContentLayout'; | ||
|
||
export default { | ||
title: 'shared/StickyContentLayout', | ||
component: StickyContentLayout, | ||
argTypes: { | ||
backgroundColor: { control: 'color' }, | ||
}, | ||
} as ComponentMeta<typeof StickyContentLayout>; | ||
|
||
const Template: ComponentStory<typeof StickyContentLayout> = (args) => ( | ||
<StickyContentLayout {...args} /> | ||
); | ||
|
||
export const Primary = Template.bind({}); | ||
Primary.args = { | ||
className: 'custom-class', | ||
content: <div>Content</div>, | ||
left: <div>Left</div>, | ||
right: <div>Right</div>, | ||
}; |
22 changes: 22 additions & 0 deletions
22
src/shared/layouts/StickyContentLayout/StickyContentLayout.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,22 @@ | ||
import { memo, ReactElement } from 'react'; | ||
import { classNames } from '@/shared/lib/classNames/classNames'; | ||
import cls from './StickyContentLayout.module.scss'; | ||
|
||
interface StickyContentLayoutProps { | ||
className?: string; | ||
left?: ReactElement; | ||
content: ReactElement; | ||
right?: ReactElement; | ||
} | ||
|
||
export const StickyContentLayout = memo((props: StickyContentLayoutProps) => { | ||
const { className, content, left, right } = props; | ||
|
||
return ( | ||
<div className={classNames(cls.MainLayout, {}, [className])}> | ||
{left && <div className={cls.left}>{left}</div>} | ||
<div className={cls.content}>{content}</div> | ||
{right && <div className={cls.right}>{right}</div>} | ||
</div> | ||
); | ||
}); |
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 @@ | ||
export { StickyContentLayout } from './StickyContentLayout'; |
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