Skip to content

Commit 6479e3a

Browse files
committed
Feat: Add HorizontalScroll to ItemList
1 parent 3a6c951 commit 6479e3a

2 files changed

Lines changed: 26 additions & 16 deletions

File tree

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Stack } from "@mui/material";
22
import React from "react";
3+
import HorizontalScroll from 'react-scroll-horizontal';
34
import TypeIcon from "_atoms/TypeIcon";
45
import Item from "_molecules/Item";
56

@@ -12,17 +13,19 @@ export default function ItemList({ items, title, icon, iconType }) {
1213
) : null}
1314
{title && <div className="item-list-title">{title}</div>}
1415
</div>
15-
<Stack direction="row" className="item-list-content" spacing={2}>
16-
{items != null ? (
17-
items.length > 0 ? (
18-
items.map((item) => <Item key={item._id} item={item} />)
16+
<HorizontalScroll className="item-list-scroll">
17+
<Stack direction="row" className="item-list-content" spacing={2}>
18+
{items != null ? (
19+
items.length > 0 ? (
20+
items.map((item) => <Item key={item._id} item={item} />)
21+
) : (
22+
<div>표시할 항목이 없습니다.</div>
23+
)
1924
) : (
20-
<div>표시할 항목이 없습니다.</div>
21-
)
22-
) : (
23-
<div>Loading...</div>
24-
)}
25-
</Stack>
25+
<div>Loading...</div>
26+
)}
27+
</Stack>
28+
</HorizontalScroll>
2629
</div>
2730
);
2831
}

frontend/styles/item-list-page.scss

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,17 @@
4747
}
4848
}
4949

50-
.item-list-content {
51-
height: $height;
52-
align-items: center;
53-
margin: 16px 0;
54-
gap: 8px;
55-
overflow-x: hidden;
50+
.item-list-scroll {
51+
width: 100% !important;
52+
height: $height + 16px * 2 !important;
53+
54+
.item-list-content {
55+
width: 100%;
56+
height: $height;
57+
display: flex;
58+
align-items: center;
59+
margin: 16px 16px 16px 0;
60+
gap: 8px;
61+
overflow-x: hidden;
62+
}
5663
}

0 commit comments

Comments
 (0)