Convert NotificationCard to Typescript
This commit is contained in:
+8
-4
@@ -1,16 +1,20 @@
|
||||
import formatDate from "../../utils/date/formatDate.js";
|
||||
import formatTime from "../../utils/date/formatTime.js";
|
||||
|
||||
import styles from "./NotificationCard.module.css"
|
||||
import Notification from "../../interfaces/notification.interface";
|
||||
|
||||
interface NotificationCardProps {
|
||||
notifications: Notification[];
|
||||
deleteNotification: (id: number) => void;
|
||||
}
|
||||
|
||||
function NotificationCard({notifications, deleteNotification}) {
|
||||
function NotificationCard({ notifications, deleteNotification }: NotificationCardProps) {
|
||||
return (
|
||||
notifications.map((notification, index) => (
|
||||
<div className={styles.notificationCard} key={index}>
|
||||
<div className={styles.cardHeader}>
|
||||
<span className={styles.timeTag}>
|
||||
Le {formatDate(notification.created_at)} à {formatTime(notification.created_at)}
|
||||
Le {formatDate(String(notification.created_at))} à {formatTime(String(notification.created_at))}
|
||||
</span>
|
||||
<button
|
||||
className={styles.closeIconButton}
|
||||
@@ -31,4 +35,4 @@ function NotificationCard({notifications, deleteNotification}) {
|
||||
);
|
||||
}
|
||||
|
||||
export default NotificationCard;
|
||||
export default NotificationCard;
|
||||
Reference in New Issue
Block a user