| 1 | 'use client'; |
| 2 | |
| 3 | import Badge from './Badge'; |
| 4 | |
| 5 | export default function TableRow({product, columns}) { |
| 6 | return ( |
| 7 | <tr className="table-row"> |
| 8 | {columns.map(col => ( |
| 9 | <td key={col.key} className="table-cell" data-column={col.key}> |
| 10 | {col.key === 'status' ? ( |
| 11 | <Badge count={product[col.key]} variant="status" /> |
| 12 | ) : col.key === 'price' ? ( |
| 13 | <span className="price">${product[col.key]}</span> |
| 14 | ) : col.key === 'rating' ? ( |
| 15 | <span className="rating"> |
| 16 | <span className="star">★</span> {product[col.key]} |
| 17 | <span className="review-count">({product.reviewCount})</span> |
| 18 | </span> |
| 19 | ) : col.key === 'name' ? ( |
| 20 | <div className="product-name-cell"> |
| 21 | <span className="product-name">{product.name}</span> |
| 22 | <span className="product-category">{product.category}</span> |
| 23 | </div> |
| 24 | ) : ( |
| 25 | product[col.key] |
| 26 | )} |
| 27 | </td> |
| 28 | ))} |
| 29 | </tr> |
| 30 | ); |
| 31 | } |