This commit is contained in:
Thomas Peterson 2024-10-18 08:29:21 +02:00
parent 8f57a4a0de
commit b9a775f35e
9 changed files with 26 additions and 20 deletions

View File

@ -14,6 +14,6 @@ class App implements \PHPNative\Framework\App
public function getStartWindow(): string public function getStartWindow(): string
{ {
return TestLayoutWindow::class; return MainWindow::class;
} }
} }

View File

@ -15,7 +15,7 @@ class CreateButton extends Button
public function __construct(public string $label, string $style = '') public function __construct(public string $label, string $style = '')
{ {
parent::__construct( style: "px-3 py-2 bg-sky-500 hover:bg-blue-800 text-white hover:text-green-500 m-10 p-8 w-full rounded-xl flex flex-row"); parent::__construct( style: "px-3 py-2 bg-red-400 hover:bg-blue-800 hover:text-green-500 h-50 rounded m-5");
$this->icon = new Icon(\PHPNative\Tailwind\Data\Icon::plus, style: 'text-white'); $this->icon = new Icon(\PHPNative\Tailwind\Data\Icon::plus, style: 'text-white');
$this->text = new Text($this->label, 'text-xl text-white m-3'); $this->text = new Text($this->label, 'text-xl text-white m-3');
} }

View File

@ -16,22 +16,24 @@ class CreateNewTask extends Container
public function __construct() public function __construct()
{ {
$this->style = 'flex flex-row m-10 rounded w-full'; parent::__construct(id: 'createnewtask');
$this->style = 'flex flex-row m-10 rounded';
$this->saveButton = new Button(views: new Views([ $this->saveButton = new Button(views: new Views([
new \PHPNative\UI\Widget\Icon(icon: Icon::save, style: 'text-white'), new \PHPNative\UI\Widget\Icon(icon: Icon::save, style: 'text-white'),
new Text(text: 'save Task', style: 'text-2xl text-white ml-30') new Text(text: 'save Task', style: 'text-2xl text-white ml-5')
]), style: 'flex-none w-150 bg-green-500 rounded-xl p-4 ml-10 hover:bg-green-700'); ]), style: 'flex-none w-190 bg-green-500 rounded-xl p-4 ml-10 hover:bg-green-700');
$this->textEdit = new TextEdit(style: 'flex-1 w-100 text-2xl bg-slate-200 px-10 rounded-xl text-black p-6', placeholder: 'Placeholder'); $this->textEdit = new TextEdit(style: 'flex-1 text-2xl bg-slate-200 px-10 rounded-xl text-black p-6', placeholder: 'Placeholder');
} $this->views = new Views([
public function getViews(): ?Views
{
return new Views([
$this->textEdit, $this->textEdit,
$this->saveButton, $this->saveButton,
]); ]);
} }
public function getViews(): ?Views
{
return $this->views;
}
} }

View File

@ -14,7 +14,7 @@ class MainLayout extends Container
public function __construct(public ProjectList $projectList, public TaskList $taskList, private NoProjectSelectedTaskList $noProjectSelectedTaskList) public function __construct(public ProjectList $projectList, public TaskList $taskList, private NoProjectSelectedTaskList $noProjectSelectedTaskList)
{ {
parent::__construct(); parent::__construct();
$this->style = "flex flex-row bg-slate-200"; $this->style = "flex flex-row";
$this->noProjectSelectedViews = new Views([ $this->noProjectSelectedViews = new Views([
$this->projectList, $this->projectList,
$this->noProjectSelectedTaskList $this->noProjectSelectedTaskList

View File

@ -21,7 +21,7 @@ class NoProjectSelectedTaskList extends Container
public function getViews(): ?Views public function getViews(): ?Views
{ {
return new Views([ return new Views([
$this->headline // $this->headline
]); ]);
} }
} }

View File

@ -28,11 +28,11 @@ class ProjectList extends Container
public function __construct(private Lifecycle $lifecycle, private \PHPNative\Container\Container $container) public function __construct(private Lifecycle $lifecycle, private \PHPNative\Container\Container $container)
{ {
parent::__construct(); parent::__construct();
$this->style = 'flex-none w-100 bg-yellow-400 flex flex-col'; $this->style = 'flex-none w-300 flex flex-col';
$this->createButton = new CreateButton("create Project"); $this->createButton = new CreateButton("create Project");
$this->createButton->setOnClick(fn(Worker $worker) => $this->addProject($worker)); $this->createButton->setOnClick(fn(Worker $worker) => $this->addProject($worker));
$this->listData = new ProjectListData(); $this->listData = new ProjectListData();
$this->headLine = new Text(text: 'Projects:', style: 'ml-10 mb-10 text-3xl'); $this->headLine = new Text(text: 'Projects:', style: 'ml-10 mb-2 text-3xl text-black');
$this->loadProjects(); $this->loadProjects();
} }

View File

@ -21,7 +21,7 @@ class TaskList extends Container
public function __construct(private Lifecycle $lifecycle, private \PHPNative\Container\Container $container) public function __construct(private Lifecycle $lifecycle, private \PHPNative\Container\Container $container)
{ {
$this->style = "basis-4/6 h-full flex flex-col"; $this->style = "flex-1 flex flex-col";
$this->createNewTask = new CreateNewTask(); $this->createNewTask = new CreateNewTask();
$this->listData = new TaskListData(); $this->listData = new TaskListData();
$this->headline = new Text(text:'', style: 'w-full bg-lime-200 text-4xl m-10 p-10 text-black'); $this->headline = new Text(text:'', style: 'w-full bg-lime-200 text-4xl m-10 p-10 text-black');

View File

@ -40,16 +40,20 @@ class TestLayoutView extends BaseView implements View
new Container(id: 'vertical', style: 'flex flex-col overflow-auto border border-black', views: new Views([ new Container(id: 'vertical', style: 'flex flex-col overflow-auto border border-black', views: new Views([
new Text(id:'third', text: 'third', style: 'bg-green-200'), new Text(id:'third', text: 'third', style: 'bg-green-200'),
new Text(id:'four', text: 'four', style: 'border border-black bg-slate-200'), new Text(id:'four', text: 'four', style: 'border border-black bg-slate-200'),
new Text(id:'five', text: 'five', style: 'border border-black bg-slate-200'), new Text(id:'five', text: 'five', style: 'm-10 border border-black bg-slate-200'),
new Text(id:'six', text: 'six', style: 'border border-black bg-slate-200'), new Text(id:'six', text: 'six', style: 'border border-black bg-slate-200'),
new Text(id:'seven', text: 'seven', style: 'border border-black bg-slate-200'), new Text(id:'seven', text: 'seven', style: 'p-10 border border-black bg-slate-200'),
new Text(id:'eight', text: 'eight', style: 'border border-black bg-slate-200'), new Text(id:'eight', text: 'eight', style: 'border border-black bg-slate-200'),
new Text(id:'nine', text: 'nine', style: 'border border-black bg-slate-200'), new Text(id:'nine', text: 'nine', style: 'border border-black bg-slate-200'),
new Text(id:'ten', text: 'ten', style: 'border border-black bg-slate-200'), new Text(id:'ten', text: 'ten', style: 'border border-black bg-slate-200'),
new Text(id:'eleven', text: 'eleven', style: 'border border-black bg-slate-200'), new Text(id:'eleven', text: 'eleven', style: 'border border-black bg-slate-200'),
])) ]))
])), ])),
new Container(style: 'flex-1 bg-green-300 flex flex-row'), new Container(style: 'flex-1 bg-green-300', views: new Views([
new Button(new Views([
new Text(text: 'Test Button', style: 'text-red-500 m-10')
]), style: 'm-10 bg-green-200 p-10')
])),
new Container(style: 'flex-none w-100 bg-red-400'), new Container(style: 'flex-none w-100 bg-red-400'),
])), ])),
new Container(id: 'sky', style: 'flex-1 bg-sky-600 w-full m-5'), new Container(id: 'sky', style: 'flex-1 bg-sky-600 w-full m-5'),

View File

@ -9,7 +9,7 @@ use PHPNative\UI\View;
class WindowView extends BaseView implements View class WindowView extends BaseView implements View
{ {
public string $style = "bg-green-200 w-full h-full"; public string $style = "bg-white";
public function __construct(public MainLayout $mainLayout) public function __construct(public MainLayout $mainLayout)
{ {