import React from 'react'; import './EmployeeCard.css'; /** * Kole UI EmployeeCard(React) * 对齐 组件9.txt EmployeeCard 规范:头像/姓名/工号/部门/职位/状态、悬停快捷操作、标签、可显联系方式、圆角8px/阴影低/内边距16px * employee: { name, empId, dept, position, status:'active'|'left', avatar?, tags?, phone?, email? } */ export default function EmployeeCard({ employee, showContact = false, onMessage, onView, onEdit }) { const statusText = employee.status === 'left' ? '离职' : '在职'; return (
{employee.avatar ? {employee.name} : {(employee.name || '?').charAt(0)}}
{employee.name} {statusText}
工号:{employee.empId}
部门:{employee.dept}
职位:{employee.position}
{employee.tags && employee.tags.length > 0 && (
{employee.tags.map((t) => {t})}
)} {showContact && (employee.phone || employee.email) && (
{employee.phone &&
电话:{employee.phone}
} {employee.email &&
邮箱:{employee.email}
}
)}
); } /* 用法示例: import EmployeeCard from './EmployeeCard'; const emp = { name: '张伟', empId: 'E1001', dept: '技术中心 · 前端组', position: '高级前端工程师', status: 'active', tags: ['React','TS'] }; console.log(e)} /> */