Spaces:
Running
Running
| 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); |