First commit
This commit is contained in:
commit
7cf3558ba7
12933 changed files with 1180047 additions and 0 deletions
66
app/Livewire/Web/Components/Sections/Portfolio.php
Normal file
66
app/Livewire/Web/Components/Sections/Portfolio.php
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
namespace App\Livewire\Web\Components\Sections;
|
||||
|
||||
use Livewire\Component;
|
||||
|
||||
class Portfolio extends Component
|
||||
{
|
||||
public string $activeFilter = 'alle';
|
||||
public ?array $selectedProject = null;
|
||||
public bool $showModal = false;
|
||||
public $content = [];
|
||||
public $theme = '';
|
||||
public $filters = [];
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$filters = [
|
||||
'alle' => 'Alle',
|
||||
'villen' => 'Villen',
|
||||
'penthouse' => 'Penthouse',
|
||||
'loft' => 'Loft'
|
||||
];
|
||||
$this->filters = $filters;
|
||||
$this->activeFilter = 'alle';
|
||||
$this->theme = config('app.theme', 'b2in');
|
||||
$this->content = config("content.themes.{$this->theme}.portfolio", []);
|
||||
$this->filters = config("content.themes.{$this->theme}.portfolio.filters", $filters);
|
||||
}
|
||||
|
||||
public function filterBy(string $category): void
|
||||
{
|
||||
$this->activeFilter = $category;
|
||||
}
|
||||
|
||||
public function openModal(array $project): void
|
||||
{
|
||||
$this->selectedProject = $project;
|
||||
$this->showModal = true;
|
||||
}
|
||||
|
||||
public function closeModal(): void
|
||||
{
|
||||
$this->showModal = false;
|
||||
$this->selectedProject = null;
|
||||
}
|
||||
|
||||
public function getFilteredProjects(): array
|
||||
{
|
||||
$projects = config("content.themes.{$this->theme}.portfolio.projects", []);
|
||||
|
||||
|
||||
if ($this->activeFilter === 'alle') {
|
||||
return $projects;
|
||||
}
|
||||
|
||||
return array_filter($projects, function ($project) {
|
||||
return strtolower($project['category']) === strtolower($this->activeFilter);
|
||||
});
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.web.components.sections.portfolio');
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue