Skip to content

Commit 5a63091

Browse files
committed
Added new tooltip component
1 parent dc045dd commit 5a63091

File tree

6 files changed

+24
-38
lines changed

6 files changed

+24
-38
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# Changelog
2-
32
## [2.4.0] - Not released
4-
53
### Added
64
- Inline editing component
5+
- New tooltip component
6+
## Changed
7+
- Added tooltips to the icon actions.
78
## [2.3.0] - 2021-06-26
89
### Added
910
- Default value for filters

resources/views/components/action.blade.php

Lines changed: 0 additions & 32 deletions
This file was deleted.

resources/views/components/actions/icon.blade.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
@foreach ($actions as $action)
44
@if ($action->renderIf($model, $this))
5-
<x-lv-icon-button :icon="$action->icon" size="sm" wire:click.prevent="executeAction('{{ $action->id }}', '{{ $model->getKey() }}')" />
5+
<x-lv-tooltip :tooltip="$action->title">
6+
<x-lv-icon-button :icon="$action->icon" size="sm" wire:click.prevent="executeAction('{{ $action->id }}', '{{ $model->getKey() }}')" />
7+
</x-lv-tooltip>
68
@endif
79
@endforeach
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@props(['tooltip' => ''])
2+
3+
<div x-data="{ tooltip: false }" class="cursor-pointer relative z-30 inline-flex" @mousemove.away="tooltip = false">
4+
<span @mousemove="tooltip = true" @mouseleave="tooltip = false">
5+
{{ $slot }}
6+
</span>
7+
8+
<div class="relative" x-cloak x-show.transition.origin.top="tooltip">
9+
<div class="flex justify-center absolute top-0 z-30 w-32 p-2 -mt-3 text-sm leading-tight text-white transform -translate-x-1/2 -translate-y-full bg-gray-800 rounded-md shadow-md">
10+
{{ $tooltip }}
11+
</div>
12+
<svg class="absolute z-30 w-6 h-6 text-gray-800 transform -translate-x-8 -translate-y-5 fill-current stroke-current" width="8" height="8">
13+
<rect x="12" y="-10" width="8" height="8" transform="rotate(45)" />
14+
</svg>
15+
</div>
16+
</div>

resources/views/table-view/table-view.blade.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,15 @@
1919

2020
@if (count($items))
2121
{{-- Content table --}}
22-
<div class="overflow-x-auto">
22+
<div class="overflow-x-scroll lg:overflow-x-visible">
2323
@include('laravel-views::components.table')
2424
</div>
2525

2626
@else
27-
2827
{{-- Empty data message --}}
2928
<div class="flex justify-center items-center p-4">
3029
<h3>{{ __('There are no items in this table') }}</h3>
3130
</div>
32-
3331
@endif
3432

3533
{{-- Paginator, loading indicator and totals --}}

src/LaravelViews.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public function components()
3232
'modal' => 'modal',
3333
'form.checkbox' => 'checkbox',
3434
'form.input' => 'input',
35+
'tooltip' => 'tooltip'
3536
];
3637
}
3738

0 commit comments

Comments
 (0)