Skip to content

Commit

Permalink
highlight expiring food
Browse files Browse the repository at this point in the history
  • Loading branch information
floodfx committed Jan 27, 2022
1 parent 5f6cc40 commit 995e396
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/examples/pagination/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export class PaginateLiveViewComponent extends BaseLiveViewComponent<PaginateCon
paginationLink(text: string, pageNum: number, perPageNum: number, className: string) {
const page = String(pageNum);
const perPage = String(perPageNum);
return live_patch(text, {
return live_patch(html`<button>${text}</button>`, {
to: {
path: "/paginate",
params: { page, perPage }
Expand All @@ -123,19 +123,19 @@ export class PaginateLiveViewComponent extends BaseLiveViewComponent<PaginateCon
${donation.quantity} lbs
</td>
<td>
<span class="${this.expiresClass(donation)}">
${donation.days_until_expires}
<span>
${this.expiresDecoration(donation)}
</span>
</td>
</tr>
`)
}

expiresClass(donation: Donation) {
expiresDecoration(donation: Donation) {
if (almostExpired(donation)) {
return "eat-now"
return html`<mark>${donation.days_until_expires}</mark>`
} else {
return "fresh"
return donation.days_until_expires
}
}

Expand Down

0 comments on commit 995e396

Please sign in to comment.