Skip to content
This repository was archived by the owner on Sep 18, 2025. It is now read-only.
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
14 changes: 14 additions & 0 deletions DotnetViewComponents/ViewComponents/InsetTextViewComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace DotnetViewComponents.ViewComponents
{
using Microsoft.AspNetCore.Mvc;
using DotnetViewComponents.ViewModels;

public class InsetTextViewComponent : ViewComponent
{
public IViewComponentResult Invoke(string contentHtml)
{
var model = new InsetTextViewModel(contentHtml);
return View(model);
}
}
}
12 changes: 12 additions & 0 deletions DotnetViewComponents/ViewModels/InsetTextViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace DotnetViewComponents.ViewModels
{
public class InsetTextViewModel
{
public InsetTextViewModel(string contentHtml)
{
ContentHtml = contentHtml;
}

public string ContentHtml { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@using DotnetViewComponents.ViewModels
@model InsetTextViewModel

<div class="nhsuk-inset-text">
<span class="nhsuk-u-visually-hidden">Information: </span>
<p>@Html.Raw(Model.ContentHtml)</p>
</div>