mirror of
https://github.com/dnwSilver/tld.git
synced 2024-11-25 16:42:07 +00:00
✨ Add breadcrumbs
This commit is contained in:
parent
f80a78f8cb
commit
00e5eadab1
20
src/TUI/Controls/Components/BreadCrumbsComponent.cs
Normal file
20
src/TUI/Controls/Components/BreadCrumbsComponent.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using TUI.Engine.Attributes;
|
||||
using TUI.Engine.Components;
|
||||
using TUI.Engine.Theme;
|
||||
|
||||
namespace TUI.Controls.Components;
|
||||
|
||||
public class BreadCrumbsComponent : ComponentBase
|
||||
{
|
||||
private readonly List<string> _crumbs = new() { " " };
|
||||
|
||||
public BreadCrumbsComponent(params string[] crumbs)
|
||||
{
|
||||
_crumbs.AddRange(crumbs);
|
||||
}
|
||||
|
||||
protected override Sketch DrawComponent(Size minSize)
|
||||
{
|
||||
return new Sketch(string.Join(" ".Hint(), _crumbs).Hint());
|
||||
}
|
||||
}
|
28
src/TUI/Controls/Containers/FooterContainer.cs
Normal file
28
src/TUI/Controls/Containers/FooterContainer.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using TUI.Controls.Statics;
|
||||
using TUI.Engine.Attributes.Alignments;
|
||||
using TUI.Engine.Components;
|
||||
using TUI.Engine.Containers;
|
||||
using TUI.Engine.Nodes;
|
||||
using TUI.Engine.Theme;
|
||||
|
||||
namespace TUI.Controls.Containers;
|
||||
|
||||
public class FooterContainer : ContainerBase
|
||||
{
|
||||
private readonly INode _breadcrumbs;
|
||||
|
||||
public FooterContainer(IComponent breadcrumbs)
|
||||
{
|
||||
breadcrumbs.SetAlignment(Horizontal.Left);
|
||||
breadcrumbs.SetPaddingLeft(Level.Normal);
|
||||
_breadcrumbs = breadcrumbs;
|
||||
}
|
||||
|
||||
public override Nodes GetNodes()
|
||||
{
|
||||
var copyright = new CopyrightComponent();
|
||||
copyright.SetAlignment(Horizontal.Right);
|
||||
copyright.SetPaddingRight(Level.Normal);
|
||||
return new Nodes { _breadcrumbs, copyright };
|
||||
}
|
||||
}
|
@ -3,7 +3,6 @@ using TUI.Engine.Attributes.Orientations;
|
||||
using TUI.Engine.Components;
|
||||
using TUI.Engine.Containers;
|
||||
using TUI.Engine.Nodes;
|
||||
using TUI.Engine.Theme;
|
||||
|
||||
namespace TUI.Controls.Layouts;
|
||||
|
||||
@ -13,7 +12,7 @@ public class DashboardLayout : ContainerBase, IContainer
|
||||
private readonly INode _footer;
|
||||
private readonly INode _dashboard;
|
||||
|
||||
public DashboardLayout(INode header, INode dashboard, IComponent footer)
|
||||
public DashboardLayout(INode header, INode dashboard, INode footer)
|
||||
{
|
||||
SetOrientationVertical();
|
||||
SetAdaptive(Orientation.Horizontal);
|
||||
@ -21,9 +20,6 @@ public class DashboardLayout : ContainerBase, IContainer
|
||||
|
||||
header.SetFixed(Orientation.Vertical, 6);
|
||||
footer.SetFixed(Orientation.Vertical, 1);
|
||||
footer.SetPaddingRight(Level.Normal);
|
||||
footer.SetAlignment(Horizontal.Right);
|
||||
footer.SetAlignment(Vertical.Bottom);
|
||||
|
||||
_header = header;
|
||||
_footer = footer;
|
||||
|
@ -4,6 +4,7 @@ using TUI.Controls.Containers;
|
||||
using TUI.Controls.Layouts;
|
||||
using TUI.Controls.Statics;
|
||||
using TUI.Domain;
|
||||
using TUI.Engine;
|
||||
using TUI.Engine.Rendering.Canvas;
|
||||
using TUI.Providers.Dependencies;
|
||||
using TUI.Store;
|
||||
@ -40,7 +41,6 @@ public class DependenciesPage : PageBase
|
||||
ICanvas canvas = new ConsoleCanvas();
|
||||
|
||||
var header = new HeaderContainer();
|
||||
var copyright = new CopyrightComponent();
|
||||
var dashboard = new DashboardContainer();
|
||||
var dependenciesHeader = new DependenciesContainer();
|
||||
dependenciesHeader.AddTitleStub();
|
||||
@ -59,7 +59,9 @@ public class DependenciesPage : PageBase
|
||||
dashboard.AddChildren(projectDependencies);
|
||||
}
|
||||
|
||||
var layout = new DashboardLayout(header, dashboard, copyright);
|
||||
var breadCrumbs = new BreadCrumbsComponent(" dependencies", "JavaScript");
|
||||
var footer = new FooterContainer(breadCrumbs);
|
||||
var layout = new DashboardLayout(header, dashboard, footer);
|
||||
canvas.Draw(layout);
|
||||
|
||||
// CommandLine = new CommandLine();
|
||||
|
Loading…
Reference in New Issue
Block a user