Transactions Table
Cards @bhaskar Stars:0 Views:0
<div class='tb'><div class='th'><h4>Transactions</h4><p>This month</p></div><table><thead><tr><th>Description</th><th>Date</th><th class='r'>Amount</th></tr></thead><tbody id='ttb'></tbody></table><div class='pg'><button id='tp' aria-label='Previous'>‹</button><span id='tl'>Page 1 of 2</span><button id='tn' aria-label='Next'>›</button></div></div>
<style>
.tb{width:min(540px,96%);margin:auto;background:#fff;border:1px solid #e8e8e8;border-radius:16px;overflow:hidden;font-family:Inter,Arial,sans-serif;color:#111}.th{padding:16px 18px 14px}.th h4{margin:0;font-size:15px;font-weight:600}.th p{margin:3px 0 0;font-size:13px;color:#737373}.tb table{width:100%;border-collapse:collapse}.tb th{padding:12px 18px;font-size:12.5px;font-weight:500;color:#737373;text-align:left;border-top:1px solid #f0f0f0}.tb td{padding:14px 18px;font-size:14.5px;border-top:1px solid #f4f4f4}.tb td:nth-child(2){color:#737373}.r{text-align:right!important}.pg{display:flex;justify-content:space-between;align-items:center;padding:10px 14px;border-top:1px solid #f0f0f0;font-size:13px;color:#525252}.pg button{width:30px;height:30px;border:0;border-radius:8px;background:none;font-size:20px;color:#111;cursor:pointer}.pg button:hover:not(:disabled){background:#f4f4f4}.pg button:disabled{color:#d0d0d0;cursor:default}
</style>
<script>
const P1=[['Payment from Northwind','Mar 8','+$420.00'],['AWS infrastructure','Mar 8','−$31.20'],['Stripe payout','Mar 7','+$890.00'],['Refund — Order #3207','Mar 6','−$64.00'],['Client retainer','Mar 5','+$250.00']],P2=[['Domain renewal','Mar 4','−$18.00'],['Payment from Harbor Labs','Mar 3','+$640.00'],['Design software','Mar 2','−$24.00'],['Consulting invoice','Mar 1','+$1,200.00'],['Office supplies','Feb 28','−$46.50']];let p=0;const tb=document.getElementById('ttb'),a=document.getElementById('tp'),b=document.getElementById('tn'),l=document.getElementById('tl');const draw=()=>{tb.innerHTML=(p?P2:P1).map(x=>'<tr><td>'+x[0]+'</td><td>'+x[1]+'</td><td class=r>'+x[2]+'</td></tr>').join('');a.disabled=!p;b.disabled=!!p;l.textContent='Page '+(p+1)+' of 2'};a.onclick=()=>{p=0;draw()};b.onclick=()=>{p=1;draw()};draw();
</script>