-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port Tag to new component generation (#307)
- Loading branch information
Showing
5 changed files
with
63 additions
and
26 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
src/GovUk.Frontend.AspNetCore/ComponentGeneration/DefaultComponentGenerator.Tag.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System; | ||
|
||
namespace GovUk.Frontend.AspNetCore.ComponentGeneration; | ||
|
||
public partial class DefaultComponentGenerator | ||
{ | ||
internal const string TagElement = "strong"; | ||
|
||
/// <inheritdoc/> | ||
public virtual HtmlTagBuilder GenerateTag(TagOptions options) | ||
{ | ||
ArgumentNullException.ThrowIfNull(options); | ||
options.Validate(); | ||
|
||
return new HtmlTagBuilder(TagElement) | ||
.WithCssClass("govuk-tag") | ||
.WithCssClasses(ExplodeClasses(options.Classes?.ToHtmlString())) | ||
.WithAttributes(options.Attributes) | ||
.WithAppendedHtml(GetEncodedTextOrHtml(options.Text, options.Html)!); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters