add markdown render

This commit is contained in:
kkzzhizhou 2021-11-20 17:11:13 +08:00
parent 9b15bb1236
commit e45182547f
14 changed files with 53 additions and 28 deletions

View file

@ -1,11 +1,15 @@
import Emoji from "react-emoji-render";
import * as React from "react";
import ReactMarkdown from "react-markdown";
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>
<div>
<p className="reward-text"><Emoji text={props.reward_text}></Emoji></p>
<ReactMarkdown children={props.reward_notes} />
</div>
</div>
)
}

View file

@ -9,7 +9,7 @@ export default function Index(props: any){
}
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}/>
return <RewardItem key={reward.id} id={reward.id} reward_text={reward.text} reward_notes={reward.notes} reward_value={reward.value} onChange={props.onChange}/>
})
const display = <div id="classDisplay">
<ul>{allRewards}</ul>