add markdown render
This commit is contained in:
parent
9b15bb1236
commit
e45182547f
14 changed files with 53 additions and 28 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import Emoji from "react-emoji-render";
|
||||
import * as React from "react";
|
||||
import ReactMarkdown from "react-markdown";
|
||||
|
||||
function HabitItem(props: any) {
|
||||
return (
|
||||
|
|
@ -10,8 +11,10 @@ function HabitItem(props: any) {
|
|||
<button className="habit-minus" id={"mins" + props.id} onClick={props.onChange}>
|
||||
-{props.downCount}
|
||||
</button>
|
||||
<p className="habit-text"><Emoji text={props.habit_text}></Emoji></p>
|
||||
|
||||
<div>
|
||||
<p className="habit-text"><Emoji text={props.habit_text}></Emoji></p>
|
||||
<ReactMarkdown children={props.habit_notes} />
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export default function Index(props: any){
|
|||
}
|
||||
else {
|
||||
const allHabits = props.habits.map((habit: any) => {
|
||||
return <HabitItem key={habit.id} id={habit.id} habit_text={habit.text} upCount={habit.counterUp} downCount={habit.counterDown} onChange={props.onChange}/>
|
||||
return <HabitItem key={habit.id} id={habit.id} habit_text={habit.text} habit_notes={habit.notes} upCount={habit.counterUp} downCount={habit.counterDown} onChange={props.onChange}/>
|
||||
})
|
||||
const display = <div id="classDisplay">
|
||||
<ul>{allHabits}</ul>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue