Skip to content

Commit

Permalink
WIP Short tag names
Browse files Browse the repository at this point in the history
  • Loading branch information
gunndabad committed Apr 16, 2023
1 parent 0ab5378 commit 890a96c
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 59 deletions.
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
@page

<govuk-summary-list>
<govuk-summary-list-row>
<govuk-summary-list-row-key>
<row>
<key>
Name
</govuk-summary-list-row-key>
<govuk-summary-list-row-value>
</key>
<value>
Sarah Philips
</govuk-summary-list-row-value>
<govuk-summary-list-row-actions>
<govuk-summary-list-row-action href="#" visually-hidden-text="name">Change</govuk-summary-list-row-action>
</govuk-summary-list-row-actions>
</govuk-summary-list-row>
<govuk-summary-list-row>
<govuk-summary-list-row-key>
</value>
<actions>
<action href="#" visually-hidden-text="name">Change</action>
</actions>
</row>
<row>
<key>
Date of birth
</govuk-summary-list-row-key>
<govuk-summary-list-row-value>
</key>
<value>
5 January 1978
</govuk-summary-list-row-value>
<govuk-summary-list-row-actions>
<govuk-summary-list-row-action href="#" visually-hidden-text="date of birth">Change</govuk-summary-list-row-action>
</govuk-summary-list-row-actions>
</govuk-summary-list-row>
</value>
<actions>
<action href="#" visually-hidden-text="date of birth">Change</action>
</actions>
</row>
<govuk-summary-list-row>
<govuk-summary-list-row-key>
<key>
Contact information
</govuk-summary-list-row-key>
<govuk-summary-list-row-value>
</key>
<value>
72 Guild Street<br>London<br>SE23 6FH
</govuk-summary-list-row-value>
<govuk-summary-list-row-actions>
<govuk-summary-list-row-action href="#" visually-hidden-text="contact information">Change</govuk-summary-list-row-action>
</govuk-summary-list-row-actions>
</value>
<actions>
<action href="#" visually-hidden-text="contact information">Change</action>
</actions>
</govuk-summary-list-row>
<govuk-summary-list-row>
<govuk-summary-list-row-key>
<key>
Contact details
</govuk-summary-list-row-key>
<govuk-summary-list-row-value>
</key>
<value>
<p class="govuk-body">07700 900457</p><p class="govuk-body">sarah.phillips@example.com</p>
</govuk-summary-list-row-value>
<govuk-summary-list-row-actions>
<govuk-summary-list-row-action href="#" visually-hidden-text="contact details">Change</govuk-summary-list-row-action>
</govuk-summary-list-row-actions>
</value>
<actions>
<action href="#" visually-hidden-text="contact details">Change</action>
</actions>
</govuk-summary-list-row>
</govuk-summary-list>
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
@page

<govuk-summary-list>
<govuk-summary-list-row>
<govuk-summary-list-row-key>
<row>
<key>
Name
</govuk-summary-list-row-key>
<govuk-summary-list-row-value>
</key>
<value>
Sarah Philips
</govuk-summary-list-row-value>
</govuk-summary-list-row>
<govuk-summary-list-row>
<govuk-summary-list-row-key>
</value>
</row>
<row>
<key>
Date of birth
</govuk-summary-list-row-key>
<govuk-summary-list-row-value>
</key>
<value>
5 January 1978
</govuk-summary-list-row-value>
</govuk-summary-list-row>
<govuk-summary-list-row>
<govuk-summary-list-row-key>
</value>
</row>
<row>
<key>
Contact information
</govuk-summary-list-row-key>
<govuk-summary-list-row-value>
</key>
<value>
72 Guild Street<br>London<br>SE23 6FH
</govuk-summary-list-row-value>
</govuk-summary-list-row>
<govuk-summary-list-row>
<govuk-summary-list-row-key>
</value>
</row>
<row>
<key>
Contact details
</govuk-summary-list-row-key>
<govuk-summary-list-row-value>
</key>
<value>
<p class="govuk-body">07700 900457</p><p class="govuk-body">sarah.phillips@example.com</p>
</govuk-summary-list-row-value>
</govuk-summary-list-row>
</value>
</row>
</govuk-summary-list>
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ namespace GovUk.Frontend.AspNetCore.TagHelpers
/// Represents an action in a GDS summary list row.
/// </summary>
[HtmlTargetElement(TagName, ParentTag = SummaryListRowActionsTagHelper.TagName)]
[HtmlTargetElement(TagName, ParentTag = SummaryListRowActionsTagHelper.ShortTagName)]
[HtmlTargetElement(ShortTagName, ParentTag = SummaryListRowActionsTagHelper.TagName)]
[HtmlTargetElement(ShortTagName, ParentTag = SummaryListRowActionsTagHelper.ShortTagName)]
[OutputElementHint(ComponentGenerator.SummaryListRowActionElement)]
public class SummaryListRowActionTagHelper : TagHelper
{
internal const string TagName = "govuk-summary-list-row-action";
internal const string ShortTagName = "action";

private const string VisuallyHiddenTextAttributeName = "visually-hidden-text";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ namespace GovUk.Frontend.AspNetCore.TagHelpers
/// Represents the actions wrapper in a GDS summary list component row.
/// </summary>
[HtmlTargetElement(TagName, ParentTag = SummaryListRowTagHelper.TagName)]
[RestrictChildren(SummaryListRowActionTagHelper.TagName)]
[HtmlTargetElement(TagName, ParentTag = SummaryListRowTagHelper.ShortTagName)]
[HtmlTargetElement(ShortTagName, ParentTag = SummaryListRowTagHelper.TagName)]
[HtmlTargetElement(ShortTagName, ParentTag = SummaryListRowTagHelper.ShortTagName)]
[RestrictChildren(SummaryListRowActionTagHelper.TagName, SummaryListRowActionTagHelper.ShortTagName)]
[OutputElementHint(ComponentGenerator.SummaryListRowActionsElement)]
public class SummaryListRowActionsTagHelper : TagHelper
{
internal const string TagName = "govuk-summary-list-row-actions";
internal const string ShortTagName = "actions";

/// <summary>
/// Creates a new <see cref="SummaryListRowActionsTagHelper"/>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ namespace GovUk.Frontend.AspNetCore.TagHelpers
/// Represents the value in a GDS summary list component row.
/// </summary>
[HtmlTargetElement(TagName, ParentTag = SummaryListRowTagHelper.TagName)]
[HtmlTargetElement(TagName, ParentTag = SummaryListRowTagHelper.ShortTagName)]
[HtmlTargetElement(ShortTagName, ParentTag = SummaryListRowTagHelper.TagName)]
[HtmlTargetElement(ShortTagName, ParentTag = SummaryListRowTagHelper.ShortTagName)]
[OutputElementHint(ComponentGenerator.SummaryListRowKeyElement)]
public class SummaryListRowKeyTagHelper : TagHelper
{
internal const string TagName = "govuk-summary-list-row-key";
internal const string ShortTagName = "key";

/// <inheritdoc/>
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,19 @@ namespace GovUk.Frontend.AspNetCore.TagHelpers
/// Represents a row in a GDS summary list component.
/// </summary>
[HtmlTargetElement(TagName, ParentTag = SummaryListTagHelper.TagName)]
[RestrictChildren(SummaryListRowKeyTagHelper.TagName, SummaryListRowValueTagHelper.TagName, SummaryListRowActionsTagHelper.TagName)]
[HtmlTargetElement(ShortTagName, ParentTag = SummaryListTagHelper.TagName)]
[RestrictChildren(
SummaryListRowKeyTagHelper.TagName,
SummaryListRowKeyTagHelper.ShortTagName,
SummaryListRowValueTagHelper.TagName,
SummaryListRowValueTagHelper.ShortTagName,
SummaryListRowActionsTagHelper.TagName,
SummaryListRowActionsTagHelper.ShortTagName)]
[OutputElementHint(ComponentGenerator.SummaryListRowElement)]
public class SummaryListRowTagHelper : TagHelper
{
internal const string TagName = "govuk-summary-list-row";
internal const string ShortTagName = "row";

/// <inheritdoc/>
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ namespace GovUk.Frontend.AspNetCore.TagHelpers
/// Represents the value in a GDS summary list component row.
/// </summary>
[HtmlTargetElement(TagName, ParentTag = SummaryListRowTagHelper.TagName)]
[HtmlTargetElement(TagName, ParentTag = SummaryListRowTagHelper.ShortTagName)]
[HtmlTargetElement(ShortTagName, ParentTag = SummaryListRowTagHelper.TagName)]
[HtmlTargetElement(ShortTagName, ParentTag = SummaryListRowTagHelper.ShortTagName)]
[OutputElementHint(ComponentGenerator.SummaryListRowValueElement)]
public class SummaryListRowValueTagHelper : TagHelper
{
internal const string TagName = "govuk-summary-list-row-value";
internal const string ShortTagName = "value";

/// <inheritdoc/>
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace GovUk.Frontend.AspNetCore.TagHelpers
/// Generates a GDS summary list component.
/// </summary>
[HtmlTargetElement(TagName)]
[RestrictChildren(SummaryListRowTagHelper.TagName)]
[RestrictChildren(SummaryListRowTagHelper.TagName, SummaryListRowTagHelper.ShortTagName)]
[OutputElementHint(ComponentGenerator.SummaryListElement)]
public class SummaryListTagHelper : TagHelper
{
Expand Down

0 comments on commit 890a96c

Please sign in to comment.