From 70e5783f0ef4988e28d1eb2f5917db90754dd7c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Zi=C4=85bek?= Date: Thu, 7 Oct 2021 23:23:07 +0200 Subject: [PATCH] Updated report sample to follow new text style approach --- QuestPDF.ReportSample/Layouts/ImageTemplate.cs | 3 ++- QuestPDF.ReportSample/Layouts/PhotoTemplate.cs | 12 ++++++------ QuestPDF.ReportSample/Layouts/SectionTemplate.cs | 10 +++++----- QuestPDF.ReportSample/Layouts/StandardReport.cs | 4 ++-- .../Layouts/TableOfContentsTemplate.cs | 6 +++--- QuestPDF/Infrastructure/TextStyle.cs | 3 ++- 6 files changed, 20 insertions(+), 18 deletions(-) diff --git a/QuestPDF.ReportSample/Layouts/ImageTemplate.cs b/QuestPDF.ReportSample/Layouts/ImageTemplate.cs index 673d470..0e3eca8 100644 --- a/QuestPDF.ReportSample/Layouts/ImageTemplate.cs +++ b/QuestPDF.ReportSample/Layouts/ImageTemplate.cs @@ -1,5 +1,6 @@ using System; using QuestPDF.Fluent; +using QuestPDF.Helpers; using QuestPDF.Infrastructure; namespace QuestPDF.ReportSample.Layouts @@ -24,7 +25,7 @@ namespace QuestPDF.ReportSample.Layouts { container .AspectRatio(AspectRatio) - .Background("#EEEEEE") + .Background(Colors.Grey.Lighten3) .Image(Source(Size.Zero)); } } diff --git a/QuestPDF.ReportSample/Layouts/PhotoTemplate.cs b/QuestPDF.ReportSample/Layouts/PhotoTemplate.cs index 8384147..f2a4c7d 100644 --- a/QuestPDF.ReportSample/Layouts/PhotoTemplate.cs +++ b/QuestPDF.ReportSample/Layouts/PhotoTemplate.cs @@ -48,13 +48,13 @@ namespace QuestPDF.ReportSample.Layouts { grid.Columns(6); - grid.Item().LabelCell().Text("Date", Typography.Normal); - grid.Item(2).ValueCell().Text(Model.Date?.ToString("g") ?? string.Empty, Typography.Normal); - grid.Item().LabelCell().Text("Location", Typography.Normal); - grid.Item(2).ValueCell().Text(Model.Location.Format(), Typography.Normal); + grid.Item().LabelCell().Text("Date"); + grid.Item(2).ValueCell().Text(Model.Date?.ToString("g") ?? string.Empty); + grid.Item().LabelCell().Text("Location"); + grid.Item(2).ValueCell().Text(Model.Location.Format()); - grid.Item().LabelCell().Text("Comments", Typography.Normal); - grid.Item(5).ValueCell().Text(Model.Comments, Typography.Normal); + grid.Item().LabelCell().Text("Comments"); + grid.Item(5).ValueCell().Text(Model.Comments); }); } } diff --git a/QuestPDF.ReportSample/Layouts/SectionTemplate.cs b/QuestPDF.ReportSample/Layouts/SectionTemplate.cs index f8da682..8142da9 100644 --- a/QuestPDF.ReportSample/Layouts/SectionTemplate.cs +++ b/QuestPDF.ReportSample/Layouts/SectionTemplate.cs @@ -30,11 +30,11 @@ namespace QuestPDF.ReportSample.Layouts { stack.Item().EnsureSpace(25).Row(row => { - row.ConstantColumn(150).LabelCell().Text(part.Label, Typography.Normal); + row.ConstantColumn(150).LabelCell().Text(part.Label); var frame = row.RelativeColumn().ValueCell(); if (part is ReportSectionText text) - frame.ShowEntire().Text(text.Text, Typography.Normal); + frame.ShowEntire().Text(text.Text); if (part is ReportSectionMap map) frame.Element(x => MapElement(x, map)); @@ -51,7 +51,7 @@ namespace QuestPDF.ReportSample.Layouts { if (model.ImageSource == null || model.Location == null) { - container.Text("No location provided", Typography.Normal); + container.Text("No location provided"); return; } @@ -60,7 +60,7 @@ namespace QuestPDF.ReportSample.Layouts stack.Spacing(5); stack.Item().MaxWidth(250).AspectRatio(4 / 3f).Image(Placeholders.Image); - stack.Item().Text(model.Location.Format(), Typography.Normal); + stack.Item().Text(model.Location.Format()); }); } @@ -68,7 +68,7 @@ namespace QuestPDF.ReportSample.Layouts { if (model.Photos.Count == 0) { - container.Text("No photos", Typography.Normal); + container.Text("No photos"); return; } diff --git a/QuestPDF.ReportSample/Layouts/StandardReport.cs b/QuestPDF.ReportSample/Layouts/StandardReport.cs index f31ee26..61a9150 100644 --- a/QuestPDF.ReportSample/Layouts/StandardReport.cs +++ b/QuestPDF.ReportSample/Layouts/StandardReport.cs @@ -68,8 +68,8 @@ namespace QuestPDF.ReportSample.Layouts { grid.Item().Text(text => { - text.Span($"{field.Label}: ", Typography.Normal.SemiBold()); - text.Span(field.Value, Typography.Normal); + text.Span($"{field.Label}: ", TextStyle.Default.SemiBold()); + text.Span(field.Value); }); } }); diff --git a/QuestPDF.ReportSample/Layouts/TableOfContentsTemplate.cs b/QuestPDF.ReportSample/Layouts/TableOfContentsTemplate.cs index 087cfff..64ff8f2 100644 --- a/QuestPDF.ReportSample/Layouts/TableOfContentsTemplate.cs +++ b/QuestPDF.ReportSample/Layouts/TableOfContentsTemplate.cs @@ -41,9 +41,9 @@ namespace QuestPDF.ReportSample.Layouts .InternalLink(locationName) .Row(row => { - row.ConstantColumn(25).Text($"{number}.", Typography.Normal); - row.RelativeColumn().Text(locationName, Typography.Normal); - row.ConstantColumn(150).AlignRight().Text(text => text.PageNumberOfLocation(locationName, Typography.Normal)); + row.ConstantColumn(25).Text($"{number}."); + row.RelativeColumn().Text(locationName); + row.ConstantColumn(150).AlignRight().Text(text => text.PageNumberOfLocation(locationName)); }); } } diff --git a/QuestPDF/Infrastructure/TextStyle.cs b/QuestPDF/Infrastructure/TextStyle.cs index ee8aa5d..545d7db 100644 --- a/QuestPDF/Infrastructure/TextStyle.cs +++ b/QuestPDF/Infrastructure/TextStyle.cs @@ -1,4 +1,5 @@ -using QuestPDF.Helpers; +using System; +using QuestPDF.Helpers; namespace QuestPDF.Infrastructure {