mirror of
https://gitlab.com/MrFry/qmining-page
synced 2025-04-01 20:23:44 +02:00
Added admin comments, styling
This commit is contained in:
parent
71911063b0
commit
a09e9734da
4 changed files with 56 additions and 25 deletions
|
@ -33,12 +33,18 @@ function CommentInput({ onSubmit }) {
|
||||||
function Comment({ comment, index, onComment, onDelete, onReact, uid }) {
|
function Comment({ comment, index, onComment, onDelete, onReact, uid }) {
|
||||||
const [displayed, setDisplayed] = useState(true)
|
const [displayed, setDisplayed] = useState(true)
|
||||||
const [commenting, setCommenting] = useState(false)
|
const [commenting, setCommenting] = useState(false)
|
||||||
const { text, subComments, date, user, reacts } = comment
|
const { text, subComments, date, user, reacts, adminComment } = comment
|
||||||
const own = uid === user
|
const own = uid === user
|
||||||
|
|
||||||
|
const commentStyle = adminComment
|
||||||
|
? styles.adminComment
|
||||||
|
: own
|
||||||
|
? styles.ownComment
|
||||||
|
: ''
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.comment}>
|
<div className={styles.comment}>
|
||||||
<div className={`${styles.commentData} ${own && styles.ownComment}`}>
|
<div className={`${styles.commentData} ${commentStyle}`}>
|
||||||
<div className={styles.commentHeader}>
|
<div className={styles.commentHeader}>
|
||||||
<div className={styles.userContainer}>
|
<div className={styles.userContainer}>
|
||||||
<div
|
<div
|
||||||
|
|
|
@ -5,8 +5,9 @@
|
||||||
|
|
||||||
.commentData {
|
.commentData {
|
||||||
padding: 5px 2px;
|
padding: 5px 2px;
|
||||||
border-left: 1px solid var(--text-color);
|
border-left: 2px solid var(--text-color);
|
||||||
background-color: #222;
|
background-color: #222;
|
||||||
|
border-radius: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.commentHeader {
|
.commentHeader {
|
||||||
|
@ -34,7 +35,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ownComment {
|
.ownComment {
|
||||||
border-left: 1px solid yellow;
|
border-left: 2px solid green;
|
||||||
}
|
}
|
||||||
|
|
||||||
.showHide {
|
.showHide {
|
||||||
|
@ -78,3 +79,7 @@
|
||||||
.commentAreaContainer > div {
|
.commentAreaContainer > div {
|
||||||
margin: 5px 0px;
|
margin: 5px 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.adminComment {
|
||||||
|
border-left: 2px solid yellow;
|
||||||
|
}
|
||||||
|
|
|
@ -13,21 +13,27 @@ export default function NewsEntry({
|
||||||
onComment,
|
onComment,
|
||||||
onDelete,
|
onDelete,
|
||||||
}) {
|
}) {
|
||||||
const { reacts, title, body, comments } = newsItem
|
const { reacts, title, text, user, comments, date, adminPost } = newsItem
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className={styles.newsContainer}>
|
<div
|
||||||
<div className={styles.itemNumber}>{newsKey} :</div>
|
className={`${styles.newsContainer} ${adminPost && styles.adminPost}`}
|
||||||
|
>
|
||||||
|
<div className={styles.newsHeader}>
|
||||||
<div
|
<div
|
||||||
className={styles.newsTitle}
|
className={styles.newsTitle}
|
||||||
dangerouslySetInnerHTML={{ __html: title }}
|
dangerouslySetInnerHTML={{ __html: title }}
|
||||||
/>
|
/>
|
||||||
|
<div className={styles.user}>
|
||||||
|
<div>User #{user}</div>
|
||||||
|
<div className={styles.newsDate}>{date}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
className={styles.newsBody}
|
className={styles.newsBody}
|
||||||
dangerouslySetInnerHTML={{ __html: body }}
|
dangerouslySetInnerHTML={{ __html: text }}
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
<ReactButton
|
<ReactButton
|
||||||
existingReacts={reacts}
|
existingReacts={reacts}
|
||||||
uid={uid}
|
uid={uid}
|
||||||
|
@ -35,7 +41,7 @@ export default function NewsEntry({
|
||||||
onReact({ type: 'news', reaction, isDelete })
|
onReact({ type: 'news', reaction, isDelete })
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<hr />
|
</div>
|
||||||
<Comments
|
<Comments
|
||||||
uid={uid}
|
uid={uid}
|
||||||
onReact={(path, reaction, isDelete) => {
|
onReact={(path, reaction, isDelete) => {
|
||||||
|
|
|
@ -5,22 +5,36 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.newsTitle {
|
.newsTitle {
|
||||||
font-size: 28px;
|
font-size: 20px;
|
||||||
color: var(--text-color);
|
color: var(--text-color);
|
||||||
margin: 0px 5px;
|
margin: 0px 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.itemNumber {
|
.newsDate {
|
||||||
color: #fff;
|
|
||||||
margin: 0px 5px;
|
margin: 0px 5px;
|
||||||
font-size: 24px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.newsContainer {
|
.newsContainer {
|
||||||
margin: 20px 5px;
|
margin: 5px 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.adminPost {
|
||||||
|
border-left: 5px solid yellow;
|
||||||
|
border-radius: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.newsContainer img {
|
.newsContainer img {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
min-width: 200px;
|
min-width: 200px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.newsHeader {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue