"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ListItem = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const CrossOutlineMd_1 = require("../../../icons/CrossOutlineMd");
const IconButton_1 = require("../../IconButton");
const Typography_1 = require("../../Typography");
const cva_1 = require("../../utils/cva");
const constants_1 = require("./constants");
const styles_1 = require("./styles");
const useLogic_1 = require("./useLogic");
const utils_1 = require("./utils");
const rootCva = (0, cva_1.cva)(constants_1.notificationListItemClassnames.root, {
    variants: {
        hasCloseButton: {
            true: constants_1.notificationListItemClassnames.hasCloseButton,
        },
    },
});
const ListItem = ({ id, title, date, text, priority = 'ordinary', actions, isUnread = true, onViewNotification, isDeleteButtonVisible, onDelete, }) => {
    const { ref, handleDelete } = (0, useLogic_1.useLogic)({
        id,
        onDelete,
        onViewNotification,
        isUnread,
    });
    return ((0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { ref: ref, className: rootCva({ hasCloseButton: isDeleteButtonVisible }), children: [(0, jsx_runtime_1.jsx)(styles_1.IconSlot, { children: (0, jsx_runtime_1.jsx)(styles_1.Priority, { priority: priority }) }), (0, jsx_runtime_1.jsxs)(styles_1.ListItemContent, { children: [(0, jsx_runtime_1.jsxs)(styles_1.TitleWrapper, { children: [(0, jsx_runtime_1.jsx)(styles_1.Title, { variant: isUnread ? 'h6' : 'body1', children: title }), (0, jsx_runtime_1.jsx)(Typography_1.Typography, { colorIntensity: "600", color: "grey", children: (0, utils_1.getDateFormat)(date) })] }), (0, jsx_runtime_1.jsx)(Typography_1.Typography, { variant: "body1", color: "grey", colorIntensity: "800", children: text }), actions && (0, jsx_runtime_1.jsx)(styles_1.Actions, { children: actions })] }), isDeleteButtonVisible && ((0, jsx_runtime_1.jsx)(IconButton_1.IconButton, { onClick: handleDelete, variant: "text", size: "small", color: "grey", children: (0, jsx_runtime_1.jsx)(CrossOutlineMd_1.CrossOutlineMd, {}) }))] }));
};
exports.ListItem = ListItem;
