Skip to content

Commit a13e6a3

Browse files
committed
Merge branch 'adds-responsive-option' of https://github.com/def-studio/laravel-livewire-tables into develop
2 parents 86883a2 + 0a86623 commit a13e6a3

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

resources/views/bootstrap-4/components/table/table.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="table-responsive">
1+
<div class="{{$this->responsive ? 'table-responsive' : ''}}">
22
<table {{ $attributes->except('wire:sortable') }} class="table table-striped">
33
<thead>
44
<tr>

resources/views/bootstrap-5/components/table/table.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="table-responsive">
1+
<div class="{{$this->responsive ? 'table-responsive' : ''}}">
22
<table {{ $attributes->except('wire:sortable') }} class="table table-striped">
33
<thead>
44
<tr>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@props(['customAttributes' => []])
22

3-
<td {{ $attributes->merge(array_merge(['class' => 'px-3 py-2 md:px-6 md:py-4 whitespace-nowrap text-sm leading-5 text-gray-900 dark:text-white'], $customAttributes)) }}>
3+
<td {{ $attributes->merge(['class' => 'px-3 py-2 md:px-6 md:py-4 text-sm leading-5 text-gray-900 dark:text-white'])->merge(['class' => $this->responsive ? 'whitespace-nowrap' : ''])->merge($customAttributes) }}>
44
{{ $slot }}
55
</td>

src/DataTableComponent.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ abstract class DataTableComponent extends Component
7070
*/
7171
public string $emptyMessage = 'No items found. Try to broaden your search.';
7272

73+
/**
74+
* Wheter or not to display a responsive table
75+
*
76+
* @var bool
77+
*/
78+
public bool $responsive = true;
79+
7380
/**
7481
* Name of the page parameter for pagination
7582
* Good to change the default if you have more than one datatable on a page.

0 commit comments

Comments
 (0)