-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add item list layout module (#298)
- Loading branch information
Showing
12 changed files
with
239 additions
and
5 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,33 @@ | ||
<?php | ||
|
||
namespace App\View\Components\Elements; | ||
|
||
use Closure; | ||
use Illuminate\Contracts\View\View; | ||
use Illuminate\View\Component; | ||
|
||
class Element extends Component | ||
{ | ||
/** | ||
* Create a new component instance. | ||
*/ | ||
public function __construct(public string $element_id, public string $type, public $context) | ||
{ | ||
$this->element_id = $element_id; | ||
$this->type = $type; | ||
$this->context = $context; | ||
} | ||
|
||
public function data() | ||
{ | ||
return array_merge(parent::data(), $this->context->toArray()); | ||
} | ||
|
||
/** | ||
* Get the view / contents that represent the component. | ||
*/ | ||
public function render(): View|Closure|string | ||
{ | ||
return view('components.elements.info-box'); | ||
} | ||
} |
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,18 @@ | ||
<?php | ||
|
||
namespace App\View\Components\Elements; | ||
|
||
use Closure; | ||
use Illuminate\Contracts\View\View; | ||
use Illuminate\View\Component; | ||
|
||
class InfoItem extends Element | ||
{ | ||
/** | ||
* Get the view / contents that represent the component. | ||
*/ | ||
public function render(): View|Closure|string | ||
{ | ||
return view('components.elements.info-item'); | ||
} | ||
} |
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,18 @@ | ||
<?php | ||
|
||
namespace App\View\Components\LayoutModules; | ||
|
||
use Closure; | ||
use Illuminate\Contracts\View\View; | ||
use Illuminate\View\Component; | ||
|
||
class ItemList extends Module | ||
{ | ||
/** | ||
* Get the view / contents that represent the component. | ||
*/ | ||
public function render(): View|Closure|string | ||
{ | ||
return view('components.layout-modules.item-list'); | ||
} | ||
} |
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
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,18 @@ | ||
title: '02 - Element | Info Item' | ||
fields: | ||
- | ||
handle: headline | ||
field: | ||
type: text | ||
display: Headline | ||
width: 66 | ||
- | ||
handle: icon | ||
field: common.icon | ||
config: | ||
width: 33 | ||
- | ||
handle: text | ||
field: common.text_basic | ||
config: | ||
display: Text |
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,19 @@ | ||
title: '03 - Layout Module | Item List' | ||
fields: | ||
- | ||
import: element_section_header_with_text | ||
- | ||
handle: items | ||
field: | ||
type: replicator | ||
display: Items | ||
collapse: true | ||
sets: | ||
common: | ||
display: Common | ||
sets: | ||
info_item: | ||
display: 'Info Item' | ||
fields: | ||
- | ||
import: element_info_item |
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,11 @@ | ||
<section class="grid-cols-info-item grid gap-20"> | ||
<header> | ||
<x-utilities.svg :svg="$icon" class="h-auto w-[4rem] fill-current" /> | ||
</header> | ||
<div class="space-y-4 sm:space-y-8"> | ||
<h3 class="text-h6"> | ||
{{ $headline }} | ||
</h3> | ||
<x-text :text="$text" /> | ||
</div> | ||
</section> |
24 changes: 24 additions & 0 deletions
24
resources/views/components/layout-modules/item-list.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,24 @@ | ||
<section {{ $attributes->class(['layout-content']) }}> | ||
@if ($headline) | ||
<div class="grid-cols gap sm:mb-84 lg:mb-84 mb-32 mb-52 grid"> | ||
<x-section-header class="col-span-full" :overline="$overline" :intro_text="$intro_text" | ||
alignment="center"> | ||
{{ $headline }} | ||
</x-section-header> | ||
</div> | ||
@endif | ||
<div class="grid-cols gap-x grid gap-y-32"> | ||
|
||
<ul | ||
class="gap-x col-span-full grid gap-y-52 sm:grid-cols-2 md:max-xl:col-start-2 md:max-xl:-col-end-2 xl:grid-cols-3"> | ||
|
||
@foreach ($items as $element) | ||
<li class="lg:col-span-1 sm:max-xl:[&:last-child:nth-child(odd)]:col-span-full"> | ||
<x-dynamic-component :component="'elements.' . $element['type']" :context="$element" :element_id="$element['id']" | ||
:type="$element['type']" /> | ||
</li> | ||
@endforeach | ||
</ul> | ||
|
||
</div> | ||
</section> |
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