Skip to content

Commit

Permalink
Add footer style to custom theme classes (#1733)
Browse files Browse the repository at this point in the history
  • Loading branch information
luanfreitasdev authored Oct 16, 2024
1 parent 1a0ad8d commit ef75b5e
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
count(data_get($setUp, 'footer.perPageValues')) > 1 &&
blank(data_get($setUp, 'footer.pagination')))
<footer
class="mt-50 pb-1 w-100 align-items-end px-1 d-flex flex-wrap justify-content-sm-center justify-content-md-between"
class="{{ theme_style($theme, 'footer.footer', 'mt-50 pb-1 w-100 align-items-end px-1 d-flex flex-wrap justify-content-sm-center justify-content-md-between') }}"
>
<div class="col-auto overflow-auto my-sm-2 my-md-0 ms-sm-0">
@if (filled(data_get($setUp, 'footer.perPage')) && count(data_get($setUp, 'footer.perPageValues')) > 1)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<div>
@includeIf(data_get($setUp, 'footer.includeViewOnTop'))
<div
<footer
id="pg-footer"
@class([
'justify-between' => filled(data_get($setUp, 'footer.perPage')),
'justify-end' => blank(data_get($setUp, 'footer.perPage')),
'border-x border-b rounded-b-lg border-b border-pg-primary-200 dark:bg-pg-primary-700 dark:border-pg-primary-600',
'md:flex md:flex-row w-full items-center py-3 bg-white overflow-y-auto pl-2 pr-2 relative dark:bg-pg-primary-900' => blank(
data_get($setUp, 'footer.pagination')),
theme_style($theme, 'footer.footer', 'border-x border-b rounded-b-lg border-b border-pg-primary-200 dark:bg-pg-primary-700 dark:border-pg-primary-600'),
theme_style($theme, 'footer.footer_with_pagination', 'md:flex md:flex-row w-full items-center py-3 bg-white overflow-y-auto pl-2 pr-2 relative dark:bg-pg-primary-900') => blank(data_get($setUp, 'footer.pagination')),
])
>
@if (filled(data_get($setUp, 'footer.perPage')) &&
Expand Down Expand Up @@ -53,6 +52,6 @@ class="pl-4 hidden sm:block md:block lg:block w-full"
@endif
</div>
@endif
</div>
</footer>
@includeIf(data_get($setUp, 'footer.includeViewOnBottom'))
</div>
6 changes: 4 additions & 2 deletions src/Themes/Bootstrap5.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ public function cols(): array
public function footer(): array
{
return [
'view' => $this->root() . '.footer',
'select' => '',
'view' => $this->root() . '.footer',
'select' => '',
'footer' => 'mt-50 pb-1 w-100 align-items-end px-1 d-flex flex-wrap justify-content-sm-center justify-content-md-between',
'footer_with_pagination' => '',
];
}

Expand Down
6 changes: 4 additions & 2 deletions src/Themes/Tailwind.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ public function table(): array
public function footer(): array
{
return [
'view' => $this->root() . '.footer',
'select' => 'appearance-none !bg-none focus:ring-primary-600 focus-within:focus:ring-primary-600 focus-within:ring-primary-600 dark:focus-within:ring-primary-600 flex rounded-md ring-1 transition focus-within:ring-2 dark:ring-pg-primary-600 dark:text-pg-primary-300 text-gray-600 ring-gray-300 dark:bg-pg-primary-800 bg-white dark:placeholder-pg-primary-400 rounded-md border-0 bg-transparent py-1.5 px-4 pr-7 ring-0 placeholder:text-gray-400 focus:outline-none sm:text-sm sm:leading-6 w-auto',
'view' => $this->root() . '.footer',
'select' => 'appearance-none !bg-none focus:ring-primary-600 focus-within:focus:ring-primary-600 focus-within:ring-primary-600 dark:focus-within:ring-primary-600 flex rounded-md ring-1 transition focus-within:ring-2 dark:ring-pg-primary-600 dark:text-pg-primary-300 text-gray-600 ring-gray-300 dark:bg-pg-primary-800 bg-white dark:placeholder-pg-primary-400 rounded-md border-0 bg-transparent py-1.5 px-4 pr-7 ring-0 placeholder:text-gray-400 focus:outline-none sm:text-sm sm:leading-6 w-auto',
'footer' => 'border-x border-b rounded-b-lg border-b border-pg-primary-200 dark:bg-pg-primary-700 dark:border-pg-primary-600',
'footer_with_pagination' => 'md:flex md:flex-row w-full items-center py-3 bg-white overflow-y-auto pl-2 pr-2 relative dark:bg-pg-primary-900',
];
}

Expand Down
6 changes: 4 additions & 2 deletions src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ function once(callable $callback): mixed
}

if (!function_exists('theme_style')) {
function theme_style(array $theme, string $name): string
function theme_style(array $theme, string $name, ?string $default = null): string
{
return strval(data_get($theme, str($name)->append('.0')) ?? data_get($theme, $name));
return strval(
data_get($theme, str($name)->append('.0')) ?? data_get($theme, $name, $default)
);
}
}

0 comments on commit ef75b5e

Please sign in to comment.