Skip to content

Commit

Permalink
Responsive data tables
Browse files Browse the repository at this point in the history
  • Loading branch information
Rayvented committed Nov 27, 2023
1 parent 13647f1 commit e31f66c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions assets/scripts/datatables.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import DataTable from "datatables.net-dt";

Array.prototype.forEach.call(document.getElementsByClassName('dataTable'), function (element) {
new DataTable('#' + element.getAttribute('id'), {
responsive: true,
dom: 'Bfrtip',
buttons: [
{
Expand Down
5 changes: 3 additions & 2 deletions assets/styles/dataTablesApp.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ td, th {
}

.dataTables_wrapper {
@apply rounded-xl border;
/* sub 17.5rem = article ml-60 (width: 15rem) + px-3 (width: 1.5rem) + 1rem */
@apply rounded-xl border max-w-[calc(100vw_-_17.5rem)] overflow-x-auto;
}

.dataTables_wrapper::after {
Expand Down Expand Up @@ -46,7 +47,7 @@ td, th {
}

table.dataTable {
@apply min-w-full divide-y divide-surface-300 border-y;
@apply w-full divide-y divide-surface-300 border-y;
}

table.dataTable > thead {
Expand Down
2 changes: 1 addition & 1 deletion assets/styles/tailmater.css
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ body {
}

aside {
@apply hover:shadow-material hover:shadow-material w-60 rounded-r-2xl h-full overflow-hidden;
@apply hover:shadow-material hover:shadow-material w-60 rounded-r-2xl h-full overflow-hidden z-50;
}

#topbar, aside {
Expand Down

0 comments on commit e31f66c

Please sign in to comment.