Skip to content

Commit 30bb148

Browse files
committed
fix discard area
1 parent 3767f93 commit 30bb148

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/pages/Play/components/DiscardArea.tsx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
1-
import type { Hai } from "../../../utils/hai";
1+
import type { Hai, JihaiValue, HaiKind } from "../../../utils/hai";
22

33
interface DiscardAreaProps {
44
sutehai: Hai[];
55
}
66

7+
type HaiWithID = {
8+
kind: HaiKind;
9+
value: JihaiValue | number;
10+
id: number;
11+
}
12+
713
function DiscardArea(props: DiscardAreaProps) {
14+
const sutehaiWithId: HaiWithID[] = props.sutehai.map((hai, index) => {
15+
return {
16+
kind: hai.kind;
17+
value: hai.value;
18+
id: index;
19+
}
20+
})
821
return (
922
<div
1023
style={{
@@ -22,8 +35,8 @@ function DiscardArea(props: DiscardAreaProps) {
2235
listStyle: "none",
2336
}}
2437
>
25-
{props.sutehai.map((hai, index) => (
26-
<li key={index}>
38+
{sutehaiWithId.map(hai => (
39+
<li key={hai.id}>
2740
<img
2841
src={`/hai/${hai.kind}_${hai.value}.png`}
2942
alt={`${hai.kind} ${hai.value}`}

0 commit comments

Comments
 (0)