mirror of
https://gitlab.com/MrFry/qmining-page
synced 2025-04-01 20:23:44 +02:00
Added comments to news items
This commit is contained in:
parent
64697efc96
commit
71911063b0
9 changed files with 357 additions and 22 deletions
|
@ -1,29 +1,52 @@
|
|||
import React from 'react'
|
||||
|
||||
import ReactButton from './reactButton.js'
|
||||
import Comments from './comments.js'
|
||||
|
||||
import styles from './newsEntry.module.css'
|
||||
|
||||
export default function NewsEntry({ newsKey, newsItem, uid, onReact }) {
|
||||
export default function NewsEntry({
|
||||
newsKey,
|
||||
newsItem,
|
||||
uid,
|
||||
onReact,
|
||||
onComment,
|
||||
onDelete,
|
||||
}) {
|
||||
const { reacts, title, body, comments } = newsItem
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className={styles.newsContainer}>
|
||||
<div className={styles.itemNumber}>{newsKey} :</div>
|
||||
<div
|
||||
className={styles.newsTitle}
|
||||
dangerouslySetInnerHTML={{ __html: newsItem.title }}
|
||||
dangerouslySetInnerHTML={{ __html: title }}
|
||||
/>
|
||||
<div
|
||||
className={styles.newsBody}
|
||||
dangerouslySetInnerHTML={{ __html: newsItem.body }}
|
||||
dangerouslySetInnerHTML={{ __html: body }}
|
||||
/>
|
||||
</div>
|
||||
<ReactButton
|
||||
existingReacts={newsItem.reacts}
|
||||
existingReacts={reacts}
|
||||
uid={uid}
|
||||
onClick={onReact}
|
||||
onClick={(reaction, isDelete) => {
|
||||
onReact({ type: 'news', reaction, isDelete })
|
||||
}}
|
||||
/>
|
||||
<hr />
|
||||
<Comments
|
||||
uid={uid}
|
||||
onReact={(path, reaction, isDelete) => {
|
||||
onReact({ type: 'comment', path, reaction, isDelete })
|
||||
}}
|
||||
onComment={onComment}
|
||||
onDelete={onDelete}
|
||||
comments={comments}
|
||||
/>
|
||||
<hr />
|
||||
<hr />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue