Skip to content

Commit 4ffb7d3

Browse files
committed
moved the tailwind classes into css files
1 parent 0d0e6bc commit 4ffb7d3

File tree

5 files changed

+38
-7
lines changed

5 files changed

+38
-7
lines changed

packages/tables/resources/css/actions.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,8 @@
2828
&.md\:fi-align-end {
2929
@apply md:justify-end;
3030
}
31+
32+
&.fi-ta-actions-is-stacked {
33+
@apply gap-4 px-3 sm:gap-3 sm:px-0;
34+
}
3135
}

packages/tables/resources/css/cell.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,22 @@
4545
}
4646
}
4747

48+
.fi-ta-cell-is-stacked-label {
49+
@apply inline-block w-1/2 py-4 pl-4 text-xs font-semibold text-gray-500 sm:hidden;
50+
}
51+
52+
.fi-ta-cell-is-stacked-contents {
53+
@apply inline-block w-1/2 pr-4 text-sm wrap-break-word text-gray-800 sm:block sm:w-auto sm:pr-0;
54+
}
55+
56+
&.fi-ta-cell-is-stacked-actions {
57+
@apply flex w-full border-t border-gray-200 px-4 sm:table-cell sm:w-auto sm:border-none;
58+
}
59+
60+
.fi-ta-cell-is-stacked-actions-label {
61+
@apply inline-block w-1/2 text-xs font-semibold text-gray-500 sm:hidden;
62+
}
63+
4864
&.fi-vertical-align-start {
4965
@apply align-top;
5066
}

packages/tables/resources/css/header-cell.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@
7474
}
7575
}
7676

77+
&.fi-ta-header-hidden-on-mobile {
78+
@apply hidden sm:table-cell;
79+
}
80+
7781
&.sm\:fi-hidden {
7882
@apply sm:hidden;
7983
}

packages/tables/resources/css/table.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
.fi-ta-table {
22
@apply w-full table-auto divide-y divide-gray-200 text-start dark:divide-white/5;
33

4+
&.fi-ta-table-stacked-on-mobile {
5+
@apply table-fixed sm:table-auto;
6+
}
7+
48
& > thead {
59
@apply divide-y divide-gray-200 dark:divide-white/5;
610

packages/tables/resources/views/index.blade.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,7 +1279,10 @@ class="fi-ta-record-collapse-btn fi-icon-btn"
12791279
</table>
12801280
@endif
12811281
@elseif ((! ($content || $hasColumnsLayout)) && ($records !== null))
1282-
<table class="fi-ta-table w-full table-fixed sm:table-auto">
1282+
<table @class([
1283+
'fi-ta-table',
1284+
'fi-ta-table-stacked-on-mobile' => $canBeStackedOnMobile
1285+
])>
12831286
<thead>
12841287
@if ($hasColumnGroups)
12851288
<tr class="fi-ta-table-head-groups-row">
@@ -1453,7 +1456,7 @@ class="fi-ta-actions-header-cell fi-ta-empty-header-cell"
14531456
'fi-grouped' => $column->getGroup(),
14541457
'fi-wrapped' => $column->canHeaderWrap(),
14551458
'fi-ta-header-cell-sorted' => $isColumnActivelySorted,
1456-
'hidden sm:table-cell' => $canBeStackedOnMobile,
1459+
'fi-ta-header-hidden-on-mobile' => $canBeStackedOnMobile,
14571460
((($columnAlignment = $column->getAlignment()) instanceof \Filament\Support\Enums\Alignment) ? "fi-align-{$columnAlignment->value}" : (is_string($columnAlignment) ? $columnAlignment : '')),
14581461
(filled($columnHiddenFrom = $column->getHiddenFrom()) ? "{$columnHiddenFrom}:fi-hidden" : ''),
14591462
(filled($columnVisibleFrom = $column->getVisibleFrom()) ? "{$columnVisibleFrom}:fi-visible" : ''),
@@ -2020,8 +2023,8 @@ class="fi-ta-record-checkbox fi-checkbox-input"
20202023
}}
20212024
>
20222025
@if($canBeStackedOnMobile)
2023-
<div class="inline-block w-1/2 sm:hidden text-xs font-semibold text-gray-500 py-4 pl-4">{{ $column->getLabel() }}</div>
2024-
<div class="inline-block sm:block w-1/2 sm:w-auto wrap-break-word text-sm text-gray-800 pr-4 sm:pr-0">
2026+
<div class="fi-ta-cell-is-stacked-label">{{ $column->getLabel() }}</div>
2027+
<div class="fi-ta-cell-is-stacked-contents">
20252028
@endif
20262029
<{{ $columnWrapperTag }}
20272030
@if ($columnWrapperTag === 'a')
@@ -2051,15 +2054,15 @@ class="fi-ta-record-checkbox fi-checkbox-input"
20512054
@if (count($defaultRecordActions) && $recordActionsPosition === RecordActionsPosition::AfterColumns && (! $isReordering))
20522055
<td @class([
20532056
'fi-ta-cell',
2054-
'flex w-full border-t border-gray-200 sm:table-cell sm:w-auto sm:border-none px-4' => $canBeStackedOnMobile
2057+
'fi-ta-cell-is-stacked-actions' => $canBeStackedOnMobile
20552058
])>
20562059
@if($canBeStackedOnMobile)
2057-
<div class="inline-block w-1/2 sm:hidden text-xs font-semibold text-gray-500">{{ __('Actions') }}</div>
2060+
<div class="fi-ta-cell-is-stacked-actions-label">{{ __('Actions') }}</div>
20582061
@endif
20592062
<div
20602063
@class([
20612064
'fi-ta-actions',
2062-
'px-3 sm:px-0 gap-4 sm:gap-3' => $canBeStackedOnMobile,
2065+
'fi-ta-actions-is-stacked' => $canBeStackedOnMobile,
20632066
match ($recordActionsAlignment) {
20642067
Alignment::Center => 'fi-align-center',
20652068
Alignment::Start, Alignment::Left => 'fi-align-start',

0 commit comments

Comments
 (0)