KnowledgeBase_frontend/src/pages/KnowledgeBase/KnowledgeCard.jsx

64 lines
3.2 KiB
React
Raw Normal View History

2025-02-27 06:54:19 +08:00
import React from 'react';
2025-03-01 08:34:56 +08:00
import SvgIcon from '../../components/SvgIcon';
2025-02-27 06:54:19 +08:00
export default function KnowledgeCard({ title, description, documents, date, access }) {
return (
2025-03-01 05:48:24 +08:00
<div className='col-sm-6 col-md-6 col-lg-4 col-xl-3'>
<div className='knowledge-card card shadow border-0'>
2025-02-27 06:54:19 +08:00
<div className='card-body'>
<h5 className='card-title'>{title}</h5>
2025-03-01 05:48:24 +08:00
<div className='hoverdown position-absolute end-0 top-0'>
<button type='button' className='detail-btn btn'>
2025-03-01 08:34:56 +08:00
<SvgIcon className={'more-dot'} />
2025-03-01 05:48:24 +08:00
</button>
2025-03-01 08:34:56 +08:00
<ul className='hoverdown-menu shadow bg-white p-1 rounded'>
2025-03-01 05:48:24 +08:00
<li className='p-1 hoverdown-item px-2'>
删除
2025-03-01 08:34:56 +08:00
<SvgIcon className={'trash'} />
2025-03-01 05:48:24 +08:00
</li>
</ul>
</div>
2025-02-27 06:54:19 +08:00
<p className='card-text text-muted'>{description}</p>
2025-03-01 05:48:24 +08:00
<div className='text-muted d-flex align-items-center gap-1'>
2025-03-01 08:34:56 +08:00
<SvgIcon className={'file'} />
2025-02-27 06:54:19 +08:00
{documents} 文档
2025-03-01 05:48:24 +08:00
<span className='ms-3 d-flex align-items-center gap-1'>
2025-03-01 08:34:56 +08:00
<SvgIcon className={'clock'} />
2025-02-27 06:54:19 +08:00
{date}
</span>
</div>
2025-03-01 05:48:24 +08:00
<div className='mt-3 d-flex justify-content-between align-items-end'>
2025-02-27 06:54:19 +08:00
{access === 'full' ? (
2025-03-04 03:38:50 +08:00
<span className='badge bg-success-subtle text-success d-flex align-items-center gap-1'>
2025-03-01 08:34:56 +08:00
<SvgIcon className={'circle-yes'} />
2025-02-27 06:54:19 +08:00
完全访问
</span>
) : access === 'read' ? (
2025-03-04 03:38:50 +08:00
<span className='badge bg-warning-subtle text-warning d-flex align-items-center gap-1'>
2025-03-01 08:34:56 +08:00
<SvgIcon className={'eye'} />
2025-02-27 06:54:19 +08:00
只读访问
</span>
) : (
2025-03-01 05:48:24 +08:00
<span className='badge bg-dark-subtle d-flex align-items-center gap-1'>
2025-03-01 08:34:56 +08:00
<SvgIcon className={'lock'} />
2025-02-27 06:54:19 +08:00
无访问权限
</span>
)}
{access === 'full' || access === 'read' ? (
2025-03-01 05:48:24 +08:00
<button className='btn btn-outline-dark btn-sm d-flex align-items-center gap-1'>
2025-03-01 08:34:56 +08:00
<SvgIcon className={'chat-dot'} />
2025-02-27 06:54:19 +08:00
新聊天
</button>
) : (
2025-03-01 05:48:24 +08:00
<button className='btn btn-outline-dark btn-sm d-flex align-items-center gap-1'>
2025-03-01 08:34:56 +08:00
<SvgIcon className={'key'} />
2025-02-27 06:54:19 +08:00
申请权限
</button>
)}
</div>
</div>
</div>
</div>
);
}