Fixes
This commit is contained in:
parent
cbc4dd1bfe
commit
05a7f719dd
@ -6,5 +6,5 @@ use PHPNative\UI\Widget\Button;
|
||||
|
||||
class CreateButton extends Button
|
||||
{
|
||||
public string $style = "bg-green-200 hover:bg-white text-black hover:text-green-500 p-4 w-full border border-black hover:border-red-500";
|
||||
public string $style = "bg-green-200 hover:bg-white text-black hover:text-green-500 m-10 p-8 w-full border border-black hover:border-red-500";
|
||||
}
|
||||
@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Components;
|
||||
|
||||
use App\Model\Project;
|
||||
use PHPNative\Framework\Parallel\Worker;
|
||||
use PHPNative\UI\Collection\Views;
|
||||
use PHPNative\UI\Widget\Container;
|
||||
use PHPNative\UI\Widget\Label;
|
||||
@ -11,18 +13,64 @@ class ProjectList extends Container
|
||||
|
||||
public CreateButton $createButton;
|
||||
|
||||
public ProjectListData $listData;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->style = 'border-r-4 border-slate-500 basis-2/6';
|
||||
$this->style = 'border-r-4 border-slate-500 basis-2/6 h-full flex flex-col';
|
||||
$this->createButton = new CreateButton(label: "New Project");
|
||||
$this->createButton->setOnClick(fn(Worker $worker) => $this->reloadProjects($worker));
|
||||
$this->listData = new ProjectListData();
|
||||
}
|
||||
|
||||
private function reloadProjects(Worker $worker): void {
|
||||
$worker->async(function() {
|
||||
sleep("1");
|
||||
return [
|
||||
new Project(uniqid(), "First Project"),
|
||||
new Project(uniqid(), "Second Project"),
|
||||
new Project(uniqid(), "First Project"),
|
||||
new Project(uniqid(), "Second Project"),
|
||||
new Project(uniqid(), "First Project"),
|
||||
new Project(uniqid(), "Second Project"),
|
||||
new Project(uniqid(), "First Project"),
|
||||
new Project(uniqid(), "Second Project"),
|
||||
new Project(uniqid(), "First Project"),
|
||||
new Project(uniqid(), "Second Project"),
|
||||
new Project(uniqid(), "First Project"),
|
||||
new Project(uniqid(), "Second Project"),
|
||||
new Project(uniqid(), "First Project"),
|
||||
new Project(uniqid(), "Second Project"),
|
||||
new Project(uniqid(), "First Project"),
|
||||
new Project(uniqid(), "Second Project"),
|
||||
new Project(uniqid(), "First Project"),
|
||||
new Project(uniqid(), "Second Project"),
|
||||
new Project(uniqid(), "First Project"),
|
||||
new Project(uniqid(), "Second Project"),
|
||||
new Project(uniqid(), "First Project"),
|
||||
new Project(uniqid(), "Second Project"),
|
||||
new Project(uniqid(), "First Project"),
|
||||
new Project(uniqid(), "Second Project"),
|
||||
new Project(uniqid(), "Third Project")
|
||||
];
|
||||
}, function($data) {
|
||||
$this->listData->views = new Views();
|
||||
|
||||
/** @var Project $row */
|
||||
foreach($data as $row) {
|
||||
$this->listData->views->add(new Label($row->title, style: 'w-full p-2 pl-10 hover:bg-slate-300'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function getViews(): ?Views
|
||||
{
|
||||
return new Views([
|
||||
$this->createButton,
|
||||
// new Label(label: 'Projects:', style: 'w-full')
|
||||
new Label(label: 'Projects:', style: 'ml-10 w-full'),
|
||||
$this->listData
|
||||
]);
|
||||
}
|
||||
}
|
||||
25
app/Components/ProjectListData.php
Normal file
25
app/Components/ProjectListData.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Components;
|
||||
|
||||
use PHPNative\Framework\Parallel\Worker;
|
||||
use PHPNative\UI\Collection\Views;
|
||||
use PHPNative\UI\Widget\Container;
|
||||
use PHPNative\UI\Widget\Label;
|
||||
|
||||
class ProjectListData extends Container
|
||||
{
|
||||
|
||||
public Views $views;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->style = 'flex flex-col overflow-auto';
|
||||
$this->views = new Views();
|
||||
}
|
||||
|
||||
public function getViews(): ?Views
|
||||
{
|
||||
return $this->views;
|
||||
}
|
||||
}
|
||||
@ -5,16 +5,19 @@ namespace App\Components;
|
||||
use PHPNative\UI\Collection\Views;
|
||||
use PHPNative\UI\View;
|
||||
use PHPNative\UI\Widget\Container;
|
||||
use PHPNative\UI\Widget\Label;
|
||||
|
||||
class TaskList extends Container
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->style = "basis-4/6 bg-sky-400";
|
||||
$this->style = "basis-4/6 h-full flex flex-col";
|
||||
}
|
||||
|
||||
public function getViews(): ?Views
|
||||
{
|
||||
return null;
|
||||
return new Views([
|
||||
new Label(label: 'Issues', style: 'w-full p-30 m-40 bg-lime-400 text-black')
|
||||
]);
|
||||
}
|
||||
}
|
||||
10
app/Model/Project.php
Normal file
10
app/Model/Project.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
class Project
|
||||
{
|
||||
public function __construct(public string $uuid = "", public string $title = "", public string $description = "")
|
||||
{
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user