backend-01

commit fc5ebfab874c5f79146610d3e7154873e944757b

Author: Pedro Lucas Porcellis <porcellis@eletrotupi.com>

views: add common layout and sprinkle tailwind on top of it

 app/helpers/Template.php | 6 ++++++
 app/views/layout.php | 29 +++++++++++++++++++++++++++++


diff --git a/app/helpers/Template.php b/app/helpers/Template.php
index 4f14a1a7965620a629d4a13dcea2bc3851bc6a9f..29352c02a42d01bc1eebd6427ffc2b58fe066ca3 100644
--- a/app/helpers/Template.php
+++ b/app/helpers/Template.php
@@ -4,6 +4,7 @@ class Template {
   public static function render($view, $data = []) {
     // TODO: Add support for multiple controller/pages?
     $viewPath = __DIR__ . '/../views/' . $view . '.php';
+    $layoutPath = __DIR__ . '/../views/layout.php';
 
     if (!file_exists($viewPath)) {
       throw new Exception("View not found: " . $view);
@@ -14,6 +15,11 @@
     ob_start();
     include $viewPath;
     $content = ob_get_clean();
+
+    // Render within layout
+    ob_start();
+    include $layoutPath;
+    return ob_get_clean();
 
     return $content;
   }




diff --git a/app/views/layout.php b/app/views/layout.php
new file mode 100644
index 0000000000000000000000000000000000000000..74d117cec2786f0d6307d6ab0978d096ade19938
--- /dev/null
+++ b/app/views/layout.php
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html lang="pt-br">
+<head>
+  <meta charset="UTF-8">
+  <meta name="viewport" content="width=device-width, initial-scale=1.0">
+  <title><?= $title ?? 'Dinheiro' ?></title>
+  <script src="https://cdn.tailwindcss.com"></script>
+</head>
+<body class="bg-gray-100 text-gray-800">
+  <header class="bg-white shadow">
+      <div class="max-w-4xl mx-auto px-4 py-6">
+          <a href="/" class="text-2xl font-bold text-blue-700">
+            Dinheiro
+          </a>
+      </div>
+  </header>
+
+  <main class="max-w-4xl mx-auto px-4 py-8">
+      <?= $content ?>
+  </main>
+
+  <footer class="bg-white border-t mt-8">
+      <div class="max-w-4xl mx-auto px-4 py-4 text-sm text-gray-500">
+          &copy; <?= date('Y') ?> Dinheiro
+      </div>
+  </footer>
+</body>
+</html>
+