-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slideover feature #12
Closed
+212
−6
Closed
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
d1c2e61
update
bobimicroweber deb1158
update
bobimicroweber 3273261
update
bobimicroweber 9946653
update
bobimicroweber 149397c
update
bobimicroweber ab5be64
update
bobimicroweber 4c08c9e
update
bobimicroweber 1f61c19
update
bobimicroweber dca35e0
refactor names
bobimicroweber 2d2d4bf
Update item.blade.php
bobimicroweber 2f892d6
update
bobimicroweber 21a1c5f
Update item.blade.php
bobimicroweber 6e9f42c
update
bobimicroweber b99a84d
update
bobimicroweber db7ed4d
Update composer.json
bobimicroweber File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
resources/views/components/accordion-slideover/index.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
@props([ | ||
'activeAccordion' => 1, | ||
'slideOverDirection' => 'right', | ||
]) | ||
<div x-data="{ | ||
activeAccordion: 'accordion-{{ $activeAccordion }}', | ||
setActiveAccordion(id) { | ||
this.activeAccordion = (this.activeAccordion == id) ? '' : id; | ||
this.onlyOne = true; | ||
}, | ||
onlyOne: false, | ||
backToOther() { | ||
this.activeAccordion = 0; | ||
this.onlyOne = false; | ||
} | ||
}" | ||
|
||
class="fi-accordion w-full flex flex-col gap-y-4" | ||
> | ||
@if($slideOverDirection == 'right') | ||
<style> | ||
.fi-accordion-item-slide { | ||
animation: fi-accordion-item-slide-right 0.3s ease-out; | ||
} | ||
@keyframes fi-accordion-item-slide-right { | ||
0% { opacity: 0; transform: translateX(100%); } | ||
100% { opacity: 1; transform: translateX(0); } | ||
} | ||
</style> | ||
@else | ||
<style> | ||
.fi-accordion-item-slide { | ||
animation: fi-accordion-item-slide-left 0.3s ease-out; | ||
} | ||
@keyframes fi-accordion-item-slide-left { | ||
0% { opacity: 0; transform: translateX(-100%); } | ||
100% { opacity: 1; transform: translateX(0); } | ||
} | ||
</style> | ||
@endif | ||
|
||
{{ $slot }} | ||
</div> |
44 changes: 44 additions & 0 deletions
44
resources/views/components/accordion-slideover/item-header.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<div | ||
|
||
class="flex gap-4 items-center justify-between w-full p-4 text-start select-none"> | ||
|
||
<button type="button" x-show="onlyOne" | ||
class="group relative inline-block overflow-hidden rounded-full border border-gray-100 bg-gray-200 text-sm font-medium text-slate-800 hover:text-violet-600 focus:outline-none focus:ring active:bg-indigo-600 active:text-white" | ||
x-on:click="backToOther()" | ||
> | ||
<span class="ease absolute left-0 top-0 h-0 w-0 border-t-2 border-violet-600 transition-all duration-200 group-hover:w-full"></span> | ||
<span class="ease absolute right-0 top-0 h-0 w-0 border-r-2 border-violet-600 transition-all duration-200 group-hover:h-full"></span> | ||
<span class="ease absolute bottom-0 right-0 h-0 w-0 border-b-2 border-violet-600 transition-all duration-200 group-hover:w-full"></span> | ||
<span class="ease absolute bottom-0 left-0 h-0 w-0 border-l-2 border-violet-600 transition-all duration-200 group-hover:h-full"></span> | ||
|
||
@svg('heroicon-m-chevron-left','w-6 h-6 duration-200 ease-out') | ||
</button> | ||
|
||
<button type="button" | ||
class="flex items-center justify-between w-full text-start select-none" | ||
|
||
@click="()=> { | ||
if (!onlyOne) { | ||
setActiveAccordion(id); | ||
} | ||
}"> | ||
<span class="flex gap-2 font-medium items-center justify-center"> | ||
@if ($icon !== null) | ||
<x-filament::icon | ||
:icon="$icon" | ||
class="fi-accordion-item-icon h-6 w-6 shrink-0 transition duration-75" | ||
/> | ||
@endif | ||
{{ $label }} | ||
|
||
@if (filled($badge)) | ||
<x-filament::badge :color="$badgeColor" size="sm" class="w-max"> | ||
{{ $badge }} | ||
</x-filament::badge> | ||
@endif | ||
</span> | ||
<span x-show="activeAccordion !== id"> | ||
@svg('heroicon-m-chevron-right','w-4 h-4 duration-200 ease-out') | ||
</span> | ||
</button> | ||
</div> |
52 changes: 52 additions & 0 deletions
52
resources/views/components/accordion-slideover/item.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
@props([ | ||
'activeAccordion' => 1, | ||
'onlyOne' => false, | ||
'icon' => null, | ||
'label' => '', | ||
'badge' => null, | ||
'badgeColor' => null, | ||
]) | ||
|
||
<div | ||
x-data="{ | ||
id: $id('accordion') | ||
}" | ||
|
||
:x-on:form-validation-error.window=" | ||
$nextTick(() => { | ||
let error = $el.querySelector('[data-validation-error]'); | ||
|
||
if (! error) { | ||
return | ||
} | ||
|
||
setActiveAccordion($id('accordion')); | ||
}) | ||
" | ||
|
||
x-show="()=> { | ||
if (onlyOne) { | ||
return activeAccordion == id; | ||
} | ||
return true; | ||
}" | ||
|
||
class="rounded-xl ring-1 ring-gray-950/10 dark:ring-white/20 fi-accordion-item group"> | ||
|
||
<div x-show="activeAccordion !== id"> | ||
@include('zeus-accordion::components.accordion-slideover.item-header') | ||
</div> | ||
|
||
<div | ||
x-show="activeAccordion == id" | ||
x-transition:enter="fi-accordion-item-slide"> | ||
|
||
@include('zeus-accordion::components.accordion-slideover.item-header') | ||
|
||
<div class="p-4" x-show="activeAccordion == id"> | ||
{{ $slot }} | ||
</div> | ||
|
||
</div> | ||
|
||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
namespace LaraZeus\Accordion\Concerns; | ||
|
||
use Closure; | ||
|
||
trait CanBeSlided | ||
{ | ||
protected bool | Closure $isSlideOver = false; | ||
protected string | Closure $slideOverDirection = 'right'; | ||
|
||
public function slideOver(string | null $slideOverDirection = null): static | ||
{ | ||
$this->isSlideOver = true; | ||
|
||
if ($slideOverDirection) { | ||
$this->slideOverDirection = $slideOverDirection; | ||
} | ||
|
||
return $this; | ||
} | ||
|
||
public function slideOverRight() | ||
{ | ||
return $this->slideOver('right'); | ||
} | ||
|
||
public function slideOverLeft() | ||
{ | ||
return $this->slideOver('left'); | ||
} | ||
|
||
public function isSlideOver(): bool | ||
{ | ||
return $this->evaluate($this->isSlideOver); | ||
} | ||
|
||
public function getSlideOverDirection() | ||
{ | ||
return $this->evaluate($this->slideOverDirection); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you revert this since it will break the package, thank you