From 9f3e15635e08bd1daa50d6c482063d4e9247a5cf Mon Sep 17 00:00:00 2001 From: Viktor Svertoka <115661003+ViktorSvertoka@users.noreply.github.com> Date: Mon, 9 Oct 2023 12:47:28 +0300 Subject: [PATCH] Feat(JSX) Update styles --- src/components/CarItem/CarItem.styled.jsx | 7 +++++-- src/pages/Catalog/Catalog.jsx | 5 ++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/CarItem/CarItem.styled.jsx b/src/components/CarItem/CarItem.styled.jsx index 1232346..19e56a8 100644 --- a/src/components/CarItem/CarItem.styled.jsx +++ b/src/components/CarItem/CarItem.styled.jsx @@ -33,14 +33,14 @@ export const TitleWrap = styled.div` export const Title = styled.h3` color: #121417; - font-size: 16px; + font-size: 14px; font-weight: 500; line-height: 1.5; `; export const Span = styled.span` color: #3470ff; - font-size: 16px; + font-size: 14px; font-weight: 500; line-height: 1.5; `; @@ -59,6 +59,9 @@ export const List = styled.ul` width: fit-content; row-gap: 4px; margin-bottom: 28px; + width: 255px; + height: 40px; + overflow: hidden; `; export const Item = styled.li` diff --git a/src/pages/Catalog/Catalog.jsx b/src/pages/Catalog/Catalog.jsx index 06c7ace..6b82807 100644 --- a/src/pages/Catalog/Catalog.jsx +++ b/src/pages/Catalog/Catalog.jsx @@ -1,6 +1,6 @@ import React, { useState, useEffect } from 'react'; import CarItem from 'components/CarItem/CarItem'; -import { WrapperFilter, WrapperList, LoadMore } from './Catalog.styled'; // Добавьте импорт для кнопки LoadMore +import { WrapperFilter, WrapperList, LoadMore } from './Catalog.styled'; import Filter from 'components/Filter/Filter'; import { useGetCarsByPageQuery } from '../../redux/operations'; @@ -8,7 +8,7 @@ import { Loader } from 'components/Loader/Loader'; export default function Catalog() { const [page, setPage] = useState(1); - const [allCars, setAllCars] = useState([]); // Стейт для хранения всех карточек + const [allCars, setAllCars] = useState([]); const { data, error, isLoading, isFetching } = useGetCarsByPageQuery(page); @@ -18,7 +18,6 @@ export default function Catalog() { useEffect(() => { if (data) { - // Обновляем стейт allCars, добавляя новые карточки setAllCars(prevCars => [...prevCars, ...data]); } }, [data]);