Writer/src/Pages/ImageIndexPage.bf

62 lines
No EOL
1.3 KiB
Beef

namespace Writer;
using System;
using System.Collections;
class ImageIndexPage : Page
{
private String Layerinfo = new .("") ~ delete _;
public this(params Span<TOCItem> items)
{
this.AddHeading(3, "Abbildungsverzeichnis");
for (var i in items)
AddItem(i);
}
public override void ComputeStyle(System.StringView className, System.String buffer)
{
buffer.Append(scope $"""
.{className} \{
page: image-index;
\}
.article \{
display: flex;
\}
.article .item,
.article .price \{
flex: 1 0 auto;
\}
.article .dots \{
flex: 0 1 auto;
margin: 0 5px;
/*Allows too long content to be hidden.*/
overflow: hidden;
\}
.dots::before \{
display: block;
white-space: nowrap;
overflow: hidden;
text-overflow: clip;
content:
". . . . . . . . . . . . . . . . . . . . "
". . . . . . . . . . . . . . . . . . . . "
". . . . . . . . . . . . . . . . . . . . "
". . . . . . . . . . . . . . . . . . . . "
\}
""");
}
private void AddItem(TOCItem item)
{
this.[Friend]_content.Append(scope $"""
<div class="article">
<span class="item">{item.Name}</span>
<span class="dots"></span>
<span class="price">{item.Page}</span>
</div>
""");
}
}