add Rewardview Panel
This commit is contained in:
parent
bc97bcfc3f
commit
9b15bb1236
4 changed files with 37 additions and 0 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -6,6 +6,9 @@
|
||||||
node_modules
|
node_modules
|
||||||
package-lock.json
|
package-lock.json
|
||||||
|
|
||||||
|
# yarn
|
||||||
|
yarn.lock
|
||||||
|
|
||||||
|
|
||||||
*.js.map
|
*.js.map
|
||||||
|
|
||||||
|
|
|
||||||
0
.hotreload
Normal file
0
.hotreload
Normal file
13
src/view/Components/Taskview/Rewardview/RewardItem.tsx
Normal file
13
src/view/Components/Taskview/Rewardview/RewardItem.tsx
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
import Emoji from "react-emoji-render";
|
||||||
|
import * as React from "react";
|
||||||
|
|
||||||
|
function RewardItem(props: any) {
|
||||||
|
return (
|
||||||
|
<div className="reward-item" id={props.id}>
|
||||||
|
<button className="reward-click" id={props.id} onClick={props.onChange}>-{props.reward_value}</button>
|
||||||
|
<p className="reward-text"><Emoji text={props.reward_text}></Emoji></p>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default RewardItem
|
||||||
21
src/view/Components/Taskview/Rewardview/index.tsx
Normal file
21
src/view/Components/Taskview/Rewardview/index.tsx
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
import * as React from "react";
|
||||||
|
import RewardItem from "./RewardItem"
|
||||||
|
|
||||||
|
export default function Index(props: any){
|
||||||
|
if(props.rewards == undefined) {
|
||||||
|
return (<div id="classDisplay">
|
||||||
|
No Rewards present.
|
||||||
|
</div>)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const allRewards = props.rewards.map((reward: any) => {
|
||||||
|
return <RewardItem key={reward.id} id={reward.id} reward_text={reward.text} reward_value={reward.value} onChange={props.onChange}/>
|
||||||
|
})
|
||||||
|
const display = <div id="classDisplay">
|
||||||
|
<ul>{allRewards}</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
return(display);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue