Skip to content

Instantly share code, notes, and snippets.

@stevebrownlee
Created July 5, 2019 21:33
Show Gist options
  • Save stevebrownlee/9df03f18bb988908f2146147cb30fc76 to your computer and use it in GitHub Desktop.
Save stevebrownlee/9df03f18bb988908f2146147cb30fc76 to your computer and use it in GitHub Desktop.
Component for HTML dialog to display animal info
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