Spaces:
Running
Running
File size: 2,528 Bytes
18ce49c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | class DataGrid extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
:host {
display: block;
margin: 1rem 0;
}
.grid-container {
overflow-x: auto;
}
table {
width: 100%;
border-collapse: collapse;
}
th, td {
padding: 0.75rem;
text-align: left;
border-bottom: 1px solid #e5e7eb;
}
th {
background-color: #f9fafb;
font-weight: 600;
color: #374151;
}
tr:hover {
background-color: #f3f4f6;
}
.pagination {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem;
border-top: 1px solid #e5e7eb;
}
.pagination-buttons button {
margin: 0 0.25rem;
padding: 0.5rem 0.75rem;
border: 1px solid #d1d5db;
background: white;
border-radius: 0.375rem;
cursor: pointer;
}
.pagination-buttons button:hover {
background: #f3f4f6;
}
.pagination-buttons button[disabled] {
opacity: 0.5;
cursor: not-allowed;
}
</style>
<div class="grid-container">
<table>
<thead>
<tr>
<th>Date</th>
<th>Activity</th>
<th>Details</th>
<th>Amount</th>
</tr>
</thead>
<tbody>
<tr>
<td>Today, 10:30 AM</td>
<td>Production</td>
<td>9-inch Bricks (1,240 pieces)</td>
<td>-</td>
</tr>
<tr>
<td>Yesterday, 3:45 PM</td>
<td>Sale</td>
<td>To: Rajesh Construction</td>
<td>₹8,400</td>
</tr>
<tr>
<td>Yesterday, 11:20 AM</td>
<td>Payment</td>
<td>From: Gupta Builders</td>
<td>₹5,000</td>
</tr>
</tbody>
</table>
<div class="pagination">
<span class="pagination-info">Showing 1 to 3 of 3 entries</span>
<div class="pagination-buttons">
<button disabled>Previous</button>
<button disabled>Next</button>
</div>
</div>
</div>
`;
}
}
customElements.define('data-grid', DataGrid); |