Backup
This commit is contained in:
parent
147e3ba5f6
commit
cbc4dd1bfe
10
app/Components/CreateButton.php
Normal file
10
app/Components/CreateButton.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Components;
|
||||
|
||||
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";
|
||||
}
|
||||
29
app/Components/MainLayout.php
Normal file
29
app/Components/MainLayout.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Components;
|
||||
|
||||
use PHPNative\UI\Collection\Views;
|
||||
use PHPNative\UI\Widget\Container;
|
||||
|
||||
class MainLayout extends Container
|
||||
{
|
||||
public string $style = "flex w-full";
|
||||
|
||||
public ProjectList $projectList;
|
||||
public TaskList $taskList;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->projectList = new ProjectList();
|
||||
$this->taskList = new TaskList();
|
||||
}
|
||||
|
||||
public function getViews(): ?Views
|
||||
{
|
||||
return new Views([
|
||||
$this->projectList,
|
||||
$this->taskList,
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
28
app/Components/ProjectList.php
Normal file
28
app/Components/ProjectList.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Components;
|
||||
|
||||
use PHPNative\UI\Collection\Views;
|
||||
use PHPNative\UI\Widget\Container;
|
||||
use PHPNative\UI\Widget\Label;
|
||||
|
||||
class ProjectList extends Container
|
||||
{
|
||||
|
||||
public CreateButton $createButton;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->style = 'border-r-4 border-slate-500 basis-2/6';
|
||||
$this->createButton = new CreateButton(label: "New Project");
|
||||
}
|
||||
|
||||
public function getViews(): ?Views
|
||||
{
|
||||
return new Views([
|
||||
$this->createButton,
|
||||
// new Label(label: 'Projects:', style: 'w-full')
|
||||
]);
|
||||
}
|
||||
}
|
||||
20
app/Components/TaskList.php
Normal file
20
app/Components/TaskList.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Components;
|
||||
|
||||
use PHPNative\UI\Collection\Views;
|
||||
use PHPNative\UI\View;
|
||||
use PHPNative\UI\Widget\Container;
|
||||
|
||||
class TaskList extends Container
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->style = "basis-4/6 bg-sky-400";
|
||||
}
|
||||
|
||||
public function getViews(): ?Views
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
25
app/Components/WindowView.php
Normal file
25
app/Components/WindowView.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Components;
|
||||
|
||||
use PHPNative\UI\BaseView;
|
||||
use PHPNative\UI\Collection\Views;
|
||||
use PHPNative\UI\View;
|
||||
|
||||
class WindowView extends BaseView implements View
|
||||
{
|
||||
public string $style = "bg-white";
|
||||
|
||||
private MainLayout $mainLayout;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->mainLayout = new MainLayout();
|
||||
}
|
||||
|
||||
public function getViews(): ?Views
|
||||
{
|
||||
return new Views([$this->mainLayout]);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Views\Components;
|
||||
|
||||
use PHPNative\UI\Widget\Container;
|
||||
|
||||
class MainLayout extends Container
|
||||
{
|
||||
public string $style = "flex";
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Views\Components;
|
||||
|
||||
use PHPNative\UI\Widget\Button;
|
||||
|
||||
class TestButton extends Button
|
||||
{
|
||||
public string $style = "bg-slate-200 hover:bg-slate-600 md:bg-sky-100 md:hover:bg-sky-600 m-50 w-full";
|
||||
}
|
||||
@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Views;
|
||||
|
||||
use App\Views\Components\MainLayout;
|
||||
use App\Views\Components\TestButton;
|
||||
use PHPNative\UI\BaseView;
|
||||
use PHPNative\UI\View;
|
||||
use PHPNative\UI\Widget\Container;
|
||||
|
||||
class MainView extends BaseView implements View
|
||||
{
|
||||
public TestButton $testButton;
|
||||
public TestButton $test1Button;
|
||||
public function __construct()
|
||||
{
|
||||
$this->style = "bg-white p-6";
|
||||
|
||||
$this->testButton = new TestButton(label: "Exit");
|
||||
$this->test1Button = new TestButton(label: "Login");
|
||||
}
|
||||
|
||||
public function getView(): View
|
||||
{
|
||||
return new MainLayout([
|
||||
$this->test1Button,
|
||||
$this->testButton
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -2,27 +2,27 @@
|
||||
|
||||
namespace App\Windows;
|
||||
|
||||
use App\Views\MainView;
|
||||
use App\Components\WindowView;
|
||||
use PHPNative\Framework\Application\Window;
|
||||
use PHPNative\UI\View;
|
||||
|
||||
class MainWindow implements Window
|
||||
{
|
||||
|
||||
public function __construct(private MainView $mainView)
|
||||
{
|
||||
$this->mainView->testButton->setOnClick(function () use ($mainView) {
|
||||
echo $this->mainView->testButton->label;
|
||||
});
|
||||
}
|
||||
public WindowView $windowView;
|
||||
|
||||
public function getView(): View
|
||||
public function __construct()
|
||||
{
|
||||
return $this->mainView;
|
||||
$this->windowView = new WindowView();
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return "DEMO APP";
|
||||
return "Project Management Example Application";
|
||||
}
|
||||
|
||||
public function getView(): ?View
|
||||
{
|
||||
return $this->windowView;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user