feat(админка): карточка клиента и drawer
This commit is contained in:
@@ -2,12 +2,12 @@ import { h } from '/static/admin2/vendor/preact.module.js';
|
||||
import htm from '/static/admin2/vendor/htm.module.js';
|
||||
const html = htm.bind(h);
|
||||
|
||||
export const Table = ({ columns, rows, empty = 'Никого не нашлось' }) => html`
|
||||
export const Table = ({ columns, rows, empty = 'Никого не нашлось', onRowClick }) => html`
|
||||
<div class="table-wrap">
|
||||
<table>
|
||||
<thead><tr>${columns.map((c) => html`<th key=${c.key} class=${c.num ? 'num' : ''}>${c.label}</th>`)}</tr></thead>
|
||||
<tbody>${rows.length ? rows.map((row) => html`
|
||||
<tr key=${row.key}>${columns.map((c) => html`
|
||||
<tr key=${row.key} class="clickable" onClick=${() => onRowClick && onRowClick(row)}>${columns.map((c) => html`
|
||||
<td key=${c.key} class=${c.num ? 'num' : ''}>${c.render ? c.render(row) : row[c.key]}</td>`)}</tr>`)
|
||||
: html`<tr><td colSpan=${columns.length} class="empty">${empty}</td></tr>`}</tbody>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user