Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 49 additions & 62 deletions Flixen.CurriculumVitae.Layouts/Footer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ namespace Flixen.CurriculumVitae.Builder;
public class Footer : IComponent
{
private readonly string _color;
private readonly int _iconSize = 30;
private const int IconSize = 30;
private const int IconTextSize = 15;
private const int ItemSpacing = 5;
private const int RowSpacing = 30;

public Footer(string color)
{
Expand All @@ -17,85 +20,69 @@ public Footer(string color)

public void Compose(IContainer container)
{
var contactItems = new[]
{
(icon: "fa-envelope", text: "felix@flixen.se"),
(icon: "fa-phone", text: "+46737120411")
};

container.AlignCenter().Row(row =>
{
row.Spacing(30);
row.AutoItem().Column(col =>
row.Spacing(RowSpacing);
foreach (var item in contactItems)
{
col.Spacing(5);
col.Item()
.AlignCenter()
.Height(_iconSize)
.Width(_iconSize)
.Canvas((canvas, size) =>
{
using var paint = new SKPaint
{
Color = SKColor.Parse(_color),
IsStroke = false,
StrokeWidth = 2,
IsAntialias = true
};
canvas.DrawRoundRect(0, 0, size.Width, size.Height, 100, 100, paint);
row.AutoItem().Component(new ContactItemIcon(_color, item.icon, item.text));
}
});
}

using var textPaint = new SKPaint();
textPaint.TextAlign = SKTextAlign.Center;
textPaint.FilterQuality = SKFilterQuality.High;
textPaint.TextSize = 15;
textPaint.Typeface = SKTypeface.FromFamilyName("Arial");
canvas.DrawIconifiedText("{{fa-envelope color=000000}}", size.Width / 2, size.Height / 2 + textPaint.TextSize/3,
textPaint);
});
col.Item()
.Text("felix@flixen.se")
.Bold()
.FontSize(15);
});
row.AutoItem().Column(col =>
private class ContactItemIcon : IComponent
{
private readonly string _backgroundColor;
private readonly string _iconName;
private readonly string _text;

public ContactItemIcon(string backgroundColor, string iconName, string text)
{
_backgroundColor = backgroundColor;
_iconName = iconName;
_text = text;
}

public void Compose(IContainer container)
{
container.Column(col =>
{
col.Spacing(5);
col.Spacing(ItemSpacing);
col.Item()
.AlignCenter()
.Height(_iconSize)
.Width(_iconSize)
.Height(IconSize)
.Width(IconSize)
.Canvas((canvas, size) =>
{
using var paint = new SKPaint
using var backgroundPaint = new SKPaint
{
Color = SKColor.Parse(_color),
Color = SKColor.Parse(_backgroundColor),
IsStroke = false,
StrokeWidth = 2,
IsAntialias = true
};
canvas.DrawRoundRect(0, 0, size.Width, size.Height, 100, 100, paint);
canvas.DrawRoundRect(0, 0, size.Width, size.Height, 100, 100, backgroundPaint);

using var textPaint = new SKPaint();
textPaint.TextAlign = SKTextAlign.Center;
textPaint.FilterQuality = SKFilterQuality.High;
textPaint.TextSize = 15;
textPaint.Typeface = SKTypeface.FromFamilyName("Arial");
canvas.DrawIconifiedText("{{fa-phone color=000000}}", size.Width / 2, size.Height / 2 + textPaint.TextSize/3,
textPaint);
using var iconPaint = new SKPaint
{
TextAlign = SKTextAlign.Center,
FilterQuality = SKFilterQuality.High,
TextSize = IconTextSize,
Typeface = SKTypeface.FromFamilyName("Arial")
};
var iconCode = "{{" + _iconName + " color=000000}}";
canvas.DrawIconifiedText(iconCode, size.Width / 2, size.Height / 2 + iconPaint.TextSize / 3, iconPaint);
});

col.Item()
.Text("+46737120411")
.Text(_text)
.Bold()
.FontSize(15);;
.FontSize(IconTextSize);
});
});


// container.Table(table =>
// {
// table.ColumnsDefinition(def =>
// {
// def.RelativeColumn();
// def.RelativeColumn();
// });
//
// table.Cell()
// });
}
}
}