using Elternbeirat.Contracts;
using Elternbeirat.Web.Shared;
using Microsoft.AspNetCore.Components;
namespace Elternbeirat.Web.Features.Posts;
///
/// Renders one post as a card linking to the post, with date, title and teaser.
///
///
/// Shared by the posts page and the home-page posts embed, so both show posts the
/// same way. The teaser comes from the body (): posts
/// have no summary field of their own.
///
///
public partial class PostCard
{
///
/// The post to show.
///
[Parameter]
[EditorRequired]
public Post Value { get; set; } = null!;
///
/// for the large card that opens the posts page (the
/// newest post); for a regular card.
///
[Parameter]
public bool Featured { get; set; }
///
/// The card's classes; the featured card adds its modifier.
///
private string CssClass => Featured ? "post-card post-card-featured" : "post-card";
///
/// The address of the post.
///
private string Href => $"/posts/{Value.Slug}";
///
/// The teaser text; empty if the body has no paragraph text.
///
private string Teaser => Markdown.Teaser(Value.Body);
}