Skip to content

Commit

Permalink
chore: AllItemsPage, BestItemsPage 코드 정리
Browse files Browse the repository at this point in the history
  • Loading branch information
cksrlcks committed Nov 30, 2024
1 parent bf2d40b commit 2d24cc0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 28 deletions.
24 changes: 10 additions & 14 deletions src/pages/items/AllItemsPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,18 @@ import ProductList from "./components/ProductList";
import ProductFilter from "./components/ProdcutFilter";
import useRecentSearch from "./components/useRecentSearch";

const rspnSize = {
pc: 10,
tablet: 6,
mobile: 4,
};

const rspnCol = {
pc: 5,
tablet: 3,
mobile: 2,
};

export default function AllItemsPage() {
const [params, setParams] = useFilteredSearchParams({
keyword: "",
orderBy: "recent",
page: 1,
});
const { keyword, orderBy, page } = params;
const { pageSize } = usePageSize(rspnSize);
const { pageSize } = usePageSize({
pc: 10,
tablet: 6,
mobile: 4,
});
const { isLoading, error, items, totalCount } = useList(getProducts, {
page,
pageSize,
Expand Down Expand Up @@ -114,7 +106,11 @@ export default function AllItemsPage() {
keyword={keyword}
isLoading={isLoading}
error={error}
rspnCol={rspnCol}
rspnCol={{
pc: 5,
tablet: 3,
mobile: 2,
}}
/>
<Pagination {...pagination} />
</Section.Content>
Expand Down
24 changes: 10 additions & 14 deletions src/pages/items/BestItemsPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,12 @@ import { getProducts } from "@service/product";
import { Section } from "@components/Section";
import ProductList from "./components/ProductList";

const rspnSize = {
pc: 4,
tablet: 2,
mobile: 1,
};

const rspnCol = {
pc: 4,
tablet: 2,
mobile: 1,
};

export default function BestItemsPage() {
const { pageSize } = usePageSize(rspnSize);
const { pageSize } = usePageSize({
pc: 4,
tablet: 2,
mobile: 1,
});
const { isLoading, error, items } = useList(getProducts, {
pageSize,
orderBy: "favorite",
Expand All @@ -31,7 +23,11 @@ export default function BestItemsPage() {
items={items}
isLoading={isLoading}
error={error}
rspnCol={rspnCol}
rspnCol={{
pc: 4,
tablet: 2,
mobile: 1,
}}
/>
</Section.Content>
</Section>
Expand Down

0 comments on commit 2d24cc0

Please sign in to comment.