Add image viewing in blog entries
This commit is contained in:
parent
7a8fb3449d
commit
a0f93ae9c3
5 changed files with 55 additions and 5 deletions
|
|
@ -29,12 +29,30 @@ class BlogEntryComponent extends Component
|
|||
|
||||
render()
|
||||
{
|
||||
return (
|
||||
return [
|
||||
<div className="blog-entry"
|
||||
dangerouslySetInnerHTML={this.props.blog_entry_name === this.entry_name ?
|
||||
{__html: this.props.blog_entry} : null}>
|
||||
</div>
|
||||
)
|
||||
</div>,
|
||||
<div id="image-container" onclick={() => close_image()}>
|
||||
<img id="image-view"/>
|
||||
</div>,
|
||||
<script>
|
||||
{`const container = document.getElementById("image-container")
|
||||
const image_view = document.getElementById("image-view")
|
||||
|
||||
function open_image(src)
|
||||
{
|
||||
image_view.src = src
|
||||
container.style.display = 'flex'
|
||||
}
|
||||
|
||||
function close_image()
|
||||
{
|
||||
container.style.display = 'none'
|
||||
}`}
|
||||
</script>
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue