HomePage.vala 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. using Spry;
  2. using Inversion;
  3. /**
  4. * HomePage - Documentation landing page for the Spry framework
  5. *
  6. * Clean, minimal design focused on helping developers get started
  7. * with Spry quickly.
  8. */
  9. public class HomePage : PageComponent {
  10. public const string ROUTE = "/";
  11. private ComponentFactory factory = inject<ComponentFactory>();
  12. public override string markup { get {
  13. return """
  14. <div class="doc-content">
  15. <!-- Hero Section -->
  16. <section class="home-hero">
  17. <h1 class="hero-title">Spry</h1>
  18. <p class="hero-tagline">A component-based web framework for Vala</p>
  19. </section>
  20. <!-- Introduction -->
  21. <section class="doc-section">
  22. <p class="intro">
  23. Spry is a web framework that lets you build dynamic, interactive web applications
  24. using Vala. It features HTMX integration for reactive UIs, dependency injection
  25. for clean architecture, and a component model that keeps markup and logic together.
  26. </p>
  27. <p>
  28. Whether you're building a simple web service or a complex interactive application,
  29. Spry provides the tools you need with full type safety and native performance.
  30. </p>
  31. </section>
  32. <!-- Quick Links -->
  33. <section class="doc-section">
  34. <h2>Documentation</h2>
  35. <div class="quick-links">
  36. <a href="/components/overview" class="quick-link-card">
  37. <h3>Components</h3>
  38. <p>Learn about Spry's component model, lifecycle, and how to build interactive UIs.</p>
  39. </a>
  40. <a href="/page-components/overview" class="quick-link-card">
  41. <h3>Page Components</h3>
  42. <p>Understand how to create pages and use templates for consistent layouts.</p>
  43. </a>
  44. <a href="/static-resources/overview" class="quick-link-card">
  45. <h3>Static Resources</h3>
  46. <p>Serve CSS, JavaScript, images, and other static assets efficiently.</p>
  47. </a>
  48. </div>
  49. </section>
  50. <!-- Get Started Code Example -->
  51. <section class="doc-section">
  52. <h2>Get Started</h2>
  53. <p>
  54. Here's a minimal "Hello World" Spry application to get you started:
  55. </p>
  56. <spry-component name="CodeBlockComponent" sid="hello-code"/>
  57. </section>
  58. <!-- Features -->
  59. <section class="doc-section">
  60. <h2>Why Spry?</h2>
  61. <ul class="features-list">
  62. <li>
  63. <strong>Type-Safe</strong> — Full Vala type safety catches errors at compile time,
  64. not runtime.
  65. </li>
  66. <li>
  67. <strong>Component-Based</strong> — Build encapsulated, reusable components with
  68. markup and logic in one place.
  69. </li>
  70. <li>
  71. <strong>HTMX Integration</strong> — Create dynamic interfaces without writing
  72. JavaScript. HTMX handles the complexity.
  73. </li>
  74. <li>
  75. <strong>Dependency Injection</strong> — Clean architecture with Inversion of
  76. Control for services and stores.
  77. </li>
  78. <li>
  79. <strong>Native Performance</strong> — Compiled to native code for maximum
  80. throughput and minimal resource usage.
  81. </li>
  82. <li>
  83. <strong>Free & Open Source</strong> — Released under a permissive license,
  84. free to use for any project.
  85. </li>
  86. </ul>
  87. </section>
  88. </div>
  89. """;
  90. }}
  91. public override async void prepare() throws Error {
  92. var helloCode = get_component_child<CodeBlockComponent>("hello-code");
  93. helloCode.language = "Vala";
  94. helloCode.code = "public class HelloPage : PageComponent {\n" +
  95. " public override string markup { get {\n" +
  96. " return \"\"\"<!DOCTYPE html>\n" +
  97. "<html>\n" +
  98. "<body>\n" +
  99. " <h1>Hello, Spry!</h1>\n" +
  100. "</body>\n" +
  101. "</html>\"\"\";\n" +
  102. " }}\n" +
  103. "}\n\n" +
  104. "// In Main.vala\n" +
  105. "spry_cfg.add_page<HelloPage>(new EndpointRoute(\"/\"));";
  106. }
  107. }