Created
July 5, 2019 21:33
-
-
Save stevebrownlee/9df03f18bb988908f2146147cb30fc76 to your computer and use it in GitHub Desktop.
Component for HTML dialog to display animal info
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react" | |
export default ({toggleDialog, animal}) => { | |
return ( | |
<dialog id="dialog--animal"> | |
<h2> | |
Medical History for {animal.name} | |
</h2> | |
{ | |
animal.treatments.map(t => ( | |
<div key={t.id}> | |
<h4>{t.timestamp}</h4> | |
<p>{t.description}</p> | |
</div> | |
)) | |
} | |
<button style={{ | |
position: "absolute", | |
top: "1em", | |
right: "2em" | |
}} | |
onClick={toggleDialog}>close</button> | |
</dialog> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment