-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat (Builders): moves attribute/class modification to interfaces
This should make future extension methods easier to share.
- Loading branch information
1 parent
70d7314
commit c542670
Showing
6 changed files
with
51 additions
and
73 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
src/Rhythm.Drop.Builders/Links/IHtmlAttributesLinkBuilder.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,25 @@ | ||
namespace Rhythm.Drop.Builders.Links; | ||
|
||
using Rhythm.Drop.Models.Common.Attributes; | ||
|
||
/// <summary> | ||
/// A contract for creating a link builder which modifies attributes. | ||
/// </summary> | ||
/// <typeparam name="TBuilder">The type of the builder to return after modifying HTML attributes.</typeparam> | ||
public interface IHtmlAttributesLinkBuilder<TBuilder> | ||
{ | ||
/// <summary> | ||
/// Adds an attribute to the current builder. | ||
/// </summary> | ||
/// <param name="name">The name of the attribute.</param> | ||
/// <param name="value">The value of the attribute.</param> | ||
/// <returns>A <typeparamref name="TBuilder"/>.</returns> | ||
TBuilder IncludeAttribute(string name, object? value); | ||
|
||
/// <summary> | ||
/// Removes an attribute from the current builder. | ||
/// </summary> | ||
/// <param name="name">The name of the attribute.</param> | ||
/// <returns>A <typeparamref name="TBuilder"/>.</returns> | ||
TBuilder ExcludeAttribute(string name); | ||
} |
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,22 @@ | ||
namespace Rhythm.Drop.Builders.Links; | ||
|
||
/// <summary> | ||
/// A contract for creating a link builder which modifies HTML classes. | ||
/// </summary> | ||
/// <typeparam name="TBuilder">The type of the builder to return after modifying HTML classes.</typeparam> | ||
public interface IHtmlClassesLinkBuilder<TBuilder> | ||
{ | ||
/// <summary> | ||
/// Adds a class to the current builder. | ||
/// </summary> | ||
/// <param name="className">The class name to add.</param> | ||
/// <returns>A <typeparamref name="TBuilder"/>.</returns> | ||
TBuilder AddClass(string className); | ||
|
||
/// <summary> | ||
/// Adds a class to the current builder. | ||
/// </summary> | ||
/// <param name="className">The class name to remove.</param> | ||
/// <returns>A <typeparamref name="TBuilder"/>.</returns> | ||
TBuilder RemoveClass(string className); | ||
} |
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