From 2f67c99864d410ed018a47816e2de4b840985dae Mon Sep 17 00:00:00 2001 From: MTG2000 Date: Mon, 25 Jul 2022 19:43:22 +0300 Subject: [PATCH] fix: products grid items --- .../Components/StoryForm/StoryForm.tsx | 2 +- .../ExplorePage/ProjectsRow/ProjectsRow.tsx | 22 ++++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/features/Posts/pages/CreatePostPage/Components/StoryForm/StoryForm.tsx b/src/features/Posts/pages/CreatePostPage/Components/StoryForm/StoryForm.tsx index 092b43b..d8886b9 100644 --- a/src/features/Posts/pages/CreatePostPage/Components/StoryForm/StoryForm.tsx +++ b/src/features/Posts/pages/CreatePostPage/Components/StoryForm/StoryForm.tsx @@ -116,7 +116,7 @@ export default function StoryForm(props: Props) { {editMode && <>
-
+
(null!); useEffect(() => { @@ -62,7 +60,6 @@ export default function ProjectsRow({ title, link, projects }: Props) { const handleClick = (projectId: number) => { - console.log(projectId); if (!drag.current) { dispatch(openModal({ Modal: "ProjectDetailsCard", props: { projectId } })) @@ -71,10 +68,15 @@ export default function ProjectsRow({ title, link, projects }: Props) { const recalcItemsCnt = useCallback( () => { - setCarouselItmsCnt(calcNumItems()); + if (rowRef.current) { + responsive.all.items = calcNumItems(rowRef.current.clientWidth) + responsive.all.slidesToSlide = Math.floor(responsive.all.items); + } }, [], - ) + ); + + useLayoutEffect(recalcItemsCnt, [recalcItemsCnt]); useResizeListener(recalcItemsCnt) @@ -91,7 +93,7 @@ export default function ProjectsRow({ title, link, projects }: Props) { } -
+