Added some components and the template

This commit is contained in:
Booklordofthedings 2024-12-21 21:46:38 +01:00
parent 7ba7513c22
commit d939b0a2ba
3 changed files with 101 additions and 0 deletions

View file

@ -5,3 +5,6 @@ Dependencies = {corlib = "*", Aven = {Git = "https://code.booklordofthe.dev/Book
Name = "aven-ly"
TargetType = "BeefLib"
StartupObject = "aven_ly.Program"
[Configs.Debug.Win64]
PreBuildCmds = ["CopyToDependents(\"$(ProjectDir)/Setup/ly-design\")"]

72
src/Components.bf Normal file
View file

@ -0,0 +1,72 @@
namespace aven_ly;
using System;
using Aven;
static
{
public static HTML LybBox(params Span<HTML> children)
{
var toReturn = new HTML(params children);
toReturn.Name = .("div");
toReturn.AddClass("lyb-box");
return toReturn;
}
public static HTML LybText(params Span<HTML> children)
{
var toReturn = new HTML(params children);
toReturn.Name = .("p");
toReturn.AddClass("lyb-text");
return toReturn;
}
public static HTML LybLink(params Span<HTML> children)
{
var toReturn = new HTML(params children);
toReturn.Name = .("a");
toReturn.AddClass("lyb-link");
return toReturn;
}
public static HTML LybHeader1(params Span<HTML> children)
{
var toReturn = new HTML(params children);
toReturn.Name = .("h1");
toReturn.AddClass("lyb-h1 lyb-h");
return toReturn;
}
public static HTML LybHeader2(params Span<HTML> children)
{
var toReturn = new HTML(params children);
toReturn.Name = .("h2");
toReturn.AddClass("lyb-h2 lyb-h");
return toReturn;
}
public static HTML LybHeader3(params Span<HTML> children)
{
var toReturn = new HTML(params children);
toReturn.Name = .("h3");
toReturn.AddClass("lyb-h3 lyb-h");
return toReturn;
}
public static HTML LybHeader4(params Span<HTML> children)
{
var toReturn = new HTML(params children);
toReturn.Name = .("h4");
toReturn.AddClass("lyb-h4 lyb-h");
return toReturn;
}
public static HTML LybInfobox(params Span<HTML> children)
{
var toReturn = new HTML(params children);
toReturn.Name = .("p");
toReturn.AddClass("lyb-info");
return toReturn;
}
}

26
src/LyTemplate.bf Normal file
View file

@ -0,0 +1,26 @@
namespace aven_ly;
using Aven;
/*
A template override that creates a ly page template
*/
class LyTemplate : Template
{
public override void Head(System.String buffer)
{
base.Head(buffer);
buffer.Append("<link rel=\"stylesheet\" type=\"text/css\" href=\"");
for(var count in OutputFile.Split('/'))
if(@count.HasMore)
buffer.Append("../");
buffer.Append("style.css\" /> \n");
}
public override void Body(HTML body)
{
body.AddClass("lyb-body");
}
}