double
pfqgauxfb 2 months ago
parent dc94d43538
commit 620ca67caa

@ -1,7 +1,9 @@
import React, { useState } from 'react';
import { useDoc } from '@docusaurus/theme-common/internal';
import styles from './styles.module.css';
const Comments = () => {
const doc = useDoc();
const [rating, setRating] = useState(0);
const [comment, setComment] = useState('');
const [comments, setComments] = useState([]);
@ -15,6 +17,7 @@ const Comments = () => {
rating,
text: comment,
date: new Date().toLocaleString(),
docId: doc.id,
},
]);
setComment('');
@ -56,7 +59,9 @@ const Comments = () => {
</form>
<div className={styles.commentsList}>
{comments.map((item, index) => (
{comments
.filter((item) => item.docId === doc.id)
.map((item, index) => (
<div key={index} className={styles.commentItem}>
<div className={styles.commentHeader}>
<div className={styles.stars}>

Loading…
Cancel
Save