48 lines
1.3 KiB
PHP
48 lines
1.3 KiB
PHP
<?php
|
|
|
|
require_once __DIR__ . '/../vendor/autoload.php';
|
|
|
|
use PHPNative\Framework\Application;
|
|
use PHPNative\Ui\Widget\Button;
|
|
use PHPNative\Ui\Widget\Container;
|
|
use PHPNative\Ui\Widget\TextInput;
|
|
use PHPNative\Ui\Window;
|
|
|
|
$app = new Application();
|
|
$window = new Window('TextInput Test', 600, 400);
|
|
|
|
// Main container
|
|
$mainContainer = new Container('flex flex-col p-4 bg-gray-100');
|
|
|
|
// Container 1 - Red background mit fester Höhe
|
|
$container1 = new Container('bg-red-500 h-20 mb-4 p-2');
|
|
$mainContainer->addComponent($container1);
|
|
|
|
// Container 2 - Mit TextInput und Button (flex-row)
|
|
$inputContainer = new Container('flex flex-row mb-4 bg-blue-200');
|
|
|
|
$input = new TextInput(
|
|
placeholder: 'Type something...',
|
|
style: 'flex-1 p-2 border border-gray-300 rounded mr-2 h-10',
|
|
);
|
|
|
|
$button = new Button('Submit', 'bg-green-500 text-white p-2 rounded');
|
|
|
|
$inputContainer->addComponent($input);
|
|
$inputContainer->addComponent($button);
|
|
$mainContainer->addComponent($inputContainer);
|
|
|
|
// Container 3 - Green background mit fester Höhe
|
|
$container3 = new Container('bg-green-500 h-20 p-2');
|
|
$mainContainer->addComponent($container3);
|
|
|
|
$window->setRoot($mainContainer);
|
|
$app->addWindow($window);
|
|
|
|
echo "TextInput Test started!\n";
|
|
echo "- Red container (80px)\n";
|
|
echo "- Blue container with TextInput and Button (40px)\n";
|
|
echo "- Green container (80px)\n\n";
|
|
|
|
$app->run();
|