Skip to content

Commit

Permalink
Top Bar layout fixes (#43)
Browse files Browse the repository at this point in the history
* chore: update deps

* feat: get user avatar

* feat: top bar items look

* test: add getFlatpackUserAvatar method to user model
  • Loading branch information
faustoq committed Dec 15, 2023
1 parent 7adf282 commit 60a2676
Show file tree
Hide file tree
Showing 7 changed files with 194 additions and 119 deletions.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"description": "Flatpack: Administration panel for Laravel, ready to assemble.",
"keywords": [
"flatpack",
"laravel-flatpack",
"laravel",
"administration",
"admin",
Expand Down
290 changes: 178 additions & 112 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/css/flatpack.css

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions resources/views/components/user-menu.blade.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
@auth
<div x-data="{open: false}" class="relative">
<button @click="open = !open" aria-label="{{ __('User Options') }}" aria-expanded="true" aria-haspopup="true" class="flex items-center justify-center gap-2 text-sm text-gray-100 hover:text-white">
<x-icon name="user-circle" style="outline" class="w-6 h-6" />
<span>{{ $user->name }}</span>
<x-icon name="chevron-down" style="outline" class="w-3 h-3" />
<img
src="{{ $user->getFlatpackUserAvatar() }}"
alt="{{ $user->name }}"
class="w-6 h-6 rounded-full"
/>
<x-icon name="chevron-down" style="outline" class="w-3 h-3 mx-1" />
</button>
<div x-show="open"
x-transition:enter="transition ease-out duration-200"
Expand Down
4 changes: 2 additions & 2 deletions resources/views/includes/layout/topbar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ class="menu-toggle">
<livewire:flatpack.search-box />
@endif
</div>
<div class="flex items-center justify-end gap-4 w-1/2">
<div class="flex items-center justify-end gap-6 w-1/2">
@foreach (config('flatpack.layout.buttons', []) as $button)
<a href="{{ data_get($button, 'href') }}"
target="{{ data_get($button, 'target', '_self') }}"
class="outline-none inline-flex justify-center items-center group transition-all ease-in duration-150 focus:ring-0 hover:shadow-sm disabled:opacity-80 disabled:cursor-not-allowed rounded gap-x-2 text-xs px-4 py-2 text-secondary-100 border border-secondary-600 hover:bg-secondary-100 hover:text-gray-700">
class="outline-none inline-flex justify-center items-center gap-2 text-sm min-w-min h-8 opacity-70 hover:opacity-100">
@if (data_get($button, 'icon'))
<x-icon name="{{ data_get($button, 'icon') }}" style="solid" class="w-4 h-4" />
@endif
Expand Down
2 changes: 2 additions & 0 deletions src/Contracts/FlatpackUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
interface FlatpackUser
{
public function isFlatpackAdmin();

public function getFlatpackUserAvatar();
}
5 changes: 5 additions & 0 deletions tests/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,9 @@ public function posts(): HasMany
{
return $this->hasMany(Post::class);
}

public function getFlatpackUserAvatar()
{
return 'mock-avatar-url';
}
}

0 comments on commit 60a2676

Please sign in to comment.