max / balanced_breakfast
1 file changed,
+11 insertions,
-0 deletions
| @@ -387,6 +387,8 @@ | |||
| 387 | 387 | * @param {string} [model.className] - Outer-element class (added to base). | |
| 388 | 388 | * @param {string} [model.tag='div'] - Outer element tag (e.g. 'li' for lists). | |
| 389 | 389 | * @param {HTMLElement|string} [model.icon] - Left slot (string is set as textContent). | |
| 390 | + | * @param {HTMLElement|string} [model.header] - Metadata line above primary | |
| 391 | + | * (e.g. author + timestamp). Rendered as `.row-header` in the content column. | |
| 390 | 392 | * @param {HTMLElement|string} [model.primary] - Required-ish top line. String = textContent. | |
| 391 | 393 | * @param {HTMLElement|string} [model.secondary] - Sub-line. | |
| 392 | 394 | * @param {HTMLElement|string} [model.meta] - Small right-aligned label (date, count). | |
| @@ -420,6 +422,15 @@ | |||
| 420 | 422 | const content = document.createElement('div'); | |
| 421 | 423 | content.className = 'row-content'; | |
| 422 | 424 | ||
| 425 | + | // Optional metadata line above the primary text (author, timestamp, ...). | |
| 426 | + | if (model.header != null) { | |
| 427 | + | const header = document.createElement('div'); | |
| 428 | + | header.className = 'row-header'; | |
| 429 | + | if (typeof model.header === 'string') header.textContent = model.header; | |
| 430 | + | else header.appendChild(model.header); | |
| 431 | + | content.appendChild(header); | |
| 432 | + | } | |
| 433 | + | ||
| 423 | 434 | const primaryLine = document.createElement('div'); | |
| 424 | 435 | primaryLine.className = 'row-primary'; | |
| 425 | 436 | if (typeof model.primary === 'string') primaryLine.textContent = model.primary; |