-
Notifications
You must be signed in to change notification settings - Fork 0
/
Matter.jsx
35 lines (30 loc) · 976 Bytes
/
Matter.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
function Matter(props){
//if props.goodvalue<0 className="badmatter"
let isgoo=true;
const [visibled,setVisibled]=React.useState(true);
//Matterのvisible変更用
const eraseMatter = React.useCallback((visibled)=>setVisibled((prev)=>!prev),[setVisibled]);
const erase=React.useCallback(()=>{
eraseMatter();
props.subVal(props.goodvalue);
});
const VisCheck=()=>{
if(visibled){
return(
<div className={[isgoo ? 'good' :'bad','matter'].join('')}>
<div className="content">出来事:{props.content}</div>
<div className="goodvalue">良かった度:{props.goodvalue}</div>
<div className="erase-Button" onClick={erase}>削除</div>
</div>
)
}else{
return (
<div></div>
)
}
}
if(props.goodvalue<0)isgoo=false;
return(
<VisCheck/>
);
}