File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed
src/pages/Play/components Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change 1- import type { Hai } from "../../../utils/hai" ;
1+ import type { Hai , JihaiValue , HaiKind } from "../../../utils/hai" ;
22
33interface DiscardAreaProps {
44 sutehai : Hai [ ] ;
55}
66
7+ type HaiWithID = {
8+ kind : HaiKind ;
9+ value : JihaiValue | number ;
10+ id : number ;
11+ }
12+
713function 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 } ` }
You can’t perform that action at this time.
0 commit comments