-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding Accordion Blade Component and update the docs
- Loading branch information
Showing
5 changed files
with
105 additions
and
47 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
title: Blade Component | ||
weight: 4 | ||
--- | ||
|
||
## Accordion Blade Component | ||
|
||
you can use accordion as a blade component in any view you want | ||
|
||
```html | ||
<x-zeus-accordion::accordion activeAccordion="3"> | ||
<x-zeus-accordion::accordion.item | ||
:isIsolated="true" | ||
:label="__('title')" | ||
icon="heroicon-o-chevron-right" | ||
> | ||
<div class="bg-white p-4 *:py-2"> | ||
<p>title</p> | ||
<p>title</p> | ||
</div> | ||
</x-zeus-accordion::accordion.item> | ||
|
||
<x-zeus-accordion::accordion.item | ||
:isIsolated="true" | ||
:label="__('info')" | ||
icon="heroicon-o-chevron-right" | ||
> | ||
<div class="bg-white p-4 *:py-2"> | ||
<p>info</p> | ||
<p>info</p> | ||
<p>info</p> | ||
</div> | ||
</x-zeus-accordion::accordion.item> | ||
|
||
</x-zeus-accordion::accordion> | ||
``` |
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,13 @@ | ||
@props([ | ||
'activeAccordion' => 1, | ||
]) | ||
<div x-data="{ | ||
activeAccordion: 'accordion-{{ $activeAccordion }}', | ||
setActiveAccordion(id) { | ||
this.activeAccordion = (this.activeAccordion == id) ? '' : id | ||
} | ||
}" | ||
class="fi-accordion rounded-xl bg-white shadow-sm ring-1 ring-gray-950/5 dark:bg-gray-900 dark:ring-white/10 relative w-full mx-auto overflow-hidden divide-y divide-gray-200 dark:divide-white/5" | ||
> | ||
{{ $slot }} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
@props([ | ||
'activeAccordion' => 1, | ||
'isIsolated' => false, | ||
'icon' => null, | ||
'label' => '', | ||
]) | ||
<div | ||
x-data="{ | ||
id: $id('accordion'), | ||
@if($isIsolated) activeAccordion: 'accordion-{{ $activeAccordion }}', @endif | ||
}" | ||
class="fi-accordion-item group" | ||
> | ||
<button | ||
type="button" | ||
@click="setActiveAccordion(id)" | ||
class="flex items-center justify-between w-full p-4 text-start select-none" | ||
:class="{ | ||
'bg-gray-100 dark:bg-gray-800': activeAccordion == id, | ||
'bg-white': activeAccordion != id, | ||
}" | ||
> | ||
<span | ||
:class="{ | ||
'text-primary-600': activeAccordion == id , | ||
'text-gray-500': activeAccordion != id | ||
}" | ||
class="flex gap-2 font-medium items-center justify-center text-gray-500 group-hover:text-primary-600" | ||
> | ||
@if ($icon !== null) | ||
<x-filament::icon | ||
:icon="$icon" | ||
class="fi-accordion-item-icon h-6 w-6 shrink-0 transition duration-75" | ||
/> | ||
@endif | ||
{{ $label }} | ||
</span> | ||
<span :class="{ 'rotate-180': activeAccordion == id }"> | ||
@svg('heroicon-c-chevron-down','w-4 h-4 duration-200 ease-out') | ||
</span> | ||
</button> | ||
<div class="p-4" x-show="activeAccordion == id" x-collapse x-cloak> | ||
{{ $slot }} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
<div | ||
class="fi-fo-accordions-accordion outline-none p-6" | ||
> | ||
<div> | ||
{{ $getChildComponentContainer() }} | ||
</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