Skip to content
Merged
Show file tree
Hide file tree
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
38 changes: 37 additions & 1 deletion src/ScissorHands.Theme/CascadingMainLayoutBase.razor
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@
<CascadingValue Value="Plugins">
<CascadingValue Value="Document">
<CascadingValue Value="Documents">
@ChildContent
<CascadingValue Name="TaggedDocuments" Value="TaggedDocuments">
<CascadingValue Name="Tag" Value="Tag">
<CascadingValue Name="TaggedPosts" Value="TaggedPosts">
<CascadingValue Name="TaggedPages" Value="TaggedPages">
@ChildContent
</CascadingValue>
</CascadingValue>
</CascadingValue>
</CascadingValue>
</CascadingValue>
</CascadingValue>
</CascadingValue>
Expand All @@ -23,6 +31,34 @@
[Parameter]
public IEnumerable<ContentDocument>? Documents { get; set; }

/// <summary>
/// Gets or sets the dictionary of tags and their associated documents.
/// Used for tag list view.
/// </summary>
[Parameter]
public IDictionary<string, (IEnumerable<ContentDocument> Posts, IEnumerable<ContentDocument> Pages)>? TaggedDocuments { get; set; }

/// <summary>
/// Gets or sets the current tag name.
/// Used for individual tag view.
/// </summary>
[Parameter]
public string? Tag { get; set; }

/// <summary>
/// Gets or sets the posts for the current tag.
/// Used for individual tag view.
/// </summary>
[Parameter]
public IEnumerable<ContentDocument>? TaggedPosts { get; set; }

/// <summary>
/// Gets or sets the pages for the current tag.
/// Used for individual tag view.
/// </summary>
[Parameter]
public IEnumerable<ContentDocument>? TaggedPages { get; set; }

/// <summary>
/// Gets or sets the current <see cref="ContentDocument"/> instance.
/// </summary>
Expand Down
28 changes: 28 additions & 0 deletions src/ScissorHands.Theme/MainLayoutBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,34 @@ public abstract class MainLayoutBase : LayoutComponentBase
[Parameter]
public IEnumerable<ContentDocument>? Documents { get; set; }

/// <summary>
/// Gets or sets the dictionary of tags and their associated documents.
/// Used for tag list view.
/// </summary>
[Parameter]
public IDictionary<string, (IEnumerable<ContentDocument> Posts, IEnumerable<ContentDocument> Pages)>? TaggedDocuments { get; set; }

/// <summary>
/// Gets or sets the current tag name.
/// Used for individual tag view.
/// </summary>
[Parameter]
public string? Tag { get; set; }

/// <summary>
/// Gets or sets the posts for the current tag.
/// Used for individual tag view.
/// </summary>
[Parameter]
public IEnumerable<ContentDocument>? TaggedPosts { get; set; }

/// <summary>
/// Gets or sets the pages for the current tag.
/// Used for individual tag view.
/// </summary>
[Parameter]
public IEnumerable<ContentDocument>? TaggedPages { get; set; }

/// <summary>
/// Gets or sets the <see cref="ContentDocument"/> instance.
/// </summary>
Expand Down
38 changes: 38 additions & 0 deletions src/ScissorHands.Theme/TagListViewBase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using Microsoft.AspNetCore.Components;

using ScissorHands.Core.Manifests;
using ScissorHands.Core.Models;

namespace ScissorHands.Theme;

/// <summary>
/// This represents the base class entity for the tag list view component.
/// This view displays all tags with their associated posts and pages.
/// </summary>
public abstract class TagListViewBase : ComponentBase
{
/// <summary>
/// Gets or sets the dictionary of tags and their associated documents.
/// The key is the tag name, and the value is the tuple of posts and pages.
/// </summary>
[CascadingParameter(Name = "TaggedDocuments")]
public IDictionary<string, (IEnumerable<ContentDocument> Posts, IEnumerable<ContentDocument> Pages)>? TaggedDocuments { get; set; }

/// <summary>
/// Gets or sets the list of <see cref="PluginManifest"/> instances.
/// </summary>
[CascadingParameter]
public IEnumerable<PluginManifest>? Plugins { get; set; }

/// <summary>
/// Gets or sets the <see cref="ThemeManifest"/> instance.
/// </summary>
[CascadingParameter]
public ThemeManifest? Theme { get; set; }

/// <summary>
/// Gets or sets the <see cref="SiteManifest"/> instance.
/// </summary>
[CascadingParameter]
public SiteManifest? Site { get; set; }
}
49 changes: 49 additions & 0 deletions src/ScissorHands.Theme/TagViewBase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using Microsoft.AspNetCore.Components;

using ScissorHands.Core.Manifests;
using ScissorHands.Core.Models;

namespace ScissorHands.Theme;

/// <summary>
/// This represents the base class entity for the tag view component.
/// This view displays all posts and pages for a specific tag.
/// </summary>
public abstract class TagViewBase : ComponentBase
{
/// <summary>
/// Gets or sets the tag name.
/// </summary>
[CascadingParameter(Name = "Tag")]
public string? Tag { get; set; }

/// <summary>
/// Gets or sets the list of posts for this tag.
/// </summary>
[CascadingParameter(Name = "TaggedPosts")]
public IEnumerable<ContentDocument>? TaggedPosts { get; set; }

/// <summary>
/// Gets or sets the list of pages for this tag.
/// </summary>
[CascadingParameter(Name = "TaggedPages")]
public IEnumerable<ContentDocument>? TaggedPages { get; set; }

/// <summary>
/// Gets or sets the list of <see cref="PluginManifest"/> instances.
/// </summary>
[CascadingParameter]
public IEnumerable<PluginManifest>? Plugins { get; set; }

/// <summary>
/// Gets or sets the <see cref="ThemeManifest"/> instance.
/// </summary>
[CascadingParameter]
public ThemeManifest? Theme { get; set; }

/// <summary>
/// Gets or sets the <see cref="SiteManifest"/> instance.
/// </summary>
[CascadingParameter]
public SiteManifest? Site { get; set; }
}
8 changes: 6 additions & 2 deletions src/ScissorHands.Web/Generators/IStaticSiteGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@ public interface IStaticSiteGenerator
/// <typeparam name="TPostView">Type of the post view component.</typeparam>
/// <typeparam name="TPageView">Type of the page view component.</typeparam>
/// <typeparam name="TNotFoundView">Type of the not found (404) view component.</typeparam>
/// <typeparam name="TTagListView">Type of the tag list view component.</typeparam>
/// <typeparam name="TTagView">Type of the individual tag view component.</typeparam>
/// <param name="destination">The destination directory store the generated contents.</param>
/// <param name="preview">Indicates whether to generate a preview version.</param>
/// <param name="cancellationToken">A token to monitor for cancellation requests.</param>
Task BuildAsync<TMainLayout, TIndexView, TPostView, TPageView, TNotFoundView>(string destination, bool preview, CancellationToken cancellationToken)
Task BuildAsync<TMainLayout, TIndexView, TPostView, TPageView, TNotFoundView, TTagListView, TTagView>(string destination, bool preview, CancellationToken cancellationToken)
where TMainLayout : MainLayoutBase
where TIndexView : IndexViewBase
where TPostView : PostViewBase
where TPageView : PageViewBase
where TNotFoundView : NotFoundViewBase;
where TNotFoundView : NotFoundViewBase
where TTagListView : TagListViewBase
where TTagView : TagViewBase;
}
Loading