ref: move Model manipulation logic in own Element *website*
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 47s
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 47s
This way no `Element` that is only there for rendering requires any internal state.
This commit is contained in:
@@ -29,13 +29,14 @@ pub fn main() !void {
|
||||
var renderer = zterm.Renderer.Buffered.init(allocator);
|
||||
defer renderer.deinit();
|
||||
|
||||
var website: Website = .init(allocator);
|
||||
var container = try App.Container.init(allocator, .{
|
||||
.layout = .{
|
||||
.padding = .horizontal(2),
|
||||
.direction = .vertical,
|
||||
.separator = .{ .enabled = true },
|
||||
},
|
||||
}, .{});
|
||||
}, website.element());
|
||||
defer container.deinit();
|
||||
var content_container: App.Container = undefined;
|
||||
|
||||
@@ -79,7 +80,7 @@ pub fn main() !void {
|
||||
}
|
||||
// main actual tui_website page content
|
||||
{
|
||||
var content: Content = .init(allocator);
|
||||
var content: Content = .{};
|
||||
content_container = try .init(allocator, .{}, content.element());
|
||||
|
||||
var scrollable: App.Scrollable = .init(content_container, .enabled(.green, false));
|
||||
@@ -185,6 +186,7 @@ const App = zterm.App(
|
||||
|
||||
const contents = @import("content.zig");
|
||||
const Model = @import("model.zig");
|
||||
const Website = contents.Website(App);
|
||||
const Content = contents.Content(App);
|
||||
const Title = contents.Title(App);
|
||||
const InfoBanner = contents.InfoBanner(App);
|
||||
|
||||
Reference in New Issue
Block a user