diff --git a/DotnetViewComponents/ViewComponents/InsetTextViewComponent.cs b/DotnetViewComponents/ViewComponents/InsetTextViewComponent.cs new file mode 100644 index 0000000000..6601fcf6c8 --- /dev/null +++ b/DotnetViewComponents/ViewComponents/InsetTextViewComponent.cs @@ -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); + } + } +} diff --git a/DotnetViewComponents/ViewModels/InsetTextViewModel.cs b/DotnetViewComponents/ViewModels/InsetTextViewModel.cs new file mode 100644 index 0000000000..e876077a9c --- /dev/null +++ b/DotnetViewComponents/ViewModels/InsetTextViewModel.cs @@ -0,0 +1,12 @@ +namespace DotnetViewComponents.ViewModels +{ + public class InsetTextViewModel + { + public InsetTextViewModel(string contentHtml) + { + ContentHtml = contentHtml; + } + + public string ContentHtml { get; set; } + } +} diff --git a/DotnetViewComponents/Views/Shared/Components/InsetText/Default.cshtml b/DotnetViewComponents/Views/Shared/Components/InsetText/Default.cshtml new file mode 100644 index 0000000000..22d871dd63 --- /dev/null +++ b/DotnetViewComponents/Views/Shared/Components/InsetText/Default.cshtml @@ -0,0 +1,7 @@ +@using DotnetViewComponents.ViewModels +@model InsetTextViewModel + +
@Html.Raw(Model.ContentHtml)
+