-
-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Rel parameter to BitActionButton (#9524) #9525
Add Rel parameter to BitActionButton (#9524) #9525
Conversation
WalkthroughThe pull request introduces a new Changes
Assessment against linked issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
src/BlazorUI/Bit.BlazorUI/Components/Buttons/BitActionButton/BitActionButton.razor.cs (2)
66-68
: Property Href updated to OnSetHrefAndRel.Attaching [CallOnSet(nameof(OnSetHrefAndRel))] is a solid approach that ensures reactive updates to the rel attribute. Confirm usage patterns in your codebase to avoid any mismatch between Href and Rel initialization.
96-101
: New Rel property with OnSetHrefAndRel.The addition of Rel as a nullable enum is appropriate. Great that both Href and Rel share the same call-on-set method, ensuring the correct assignment of _rel. Consider adding further doc comments showing examples, for clarity.
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/BitActionButtonDemo.razor.cs (1)
113-120
: Consider providing an example usage for the newly added 'Rel' parameter.
Although the parameter addition is clear, it would be beneficial to include a small example in documentation/demo to show how to set different link relationships (e.g., "nofollow," "noopener," etc.). This ensures consumers can easily adopt the new functionality.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
src/BlazorUI/Bit.BlazorUI/Components/Buttons/BitActionButton/BitActionButton.razor
(1 hunks)src/BlazorUI/Bit.BlazorUI/Components/Buttons/BitActionButton/BitActionButton.razor.cs
(4 hunks)src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/BitActionButtonDemo.razor
(6 hunks)src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/BitActionButtonDemo.razor.cs
(2 hunks)src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/BitActionButtonDemo.razor.samples.cs
(5 hunks)
🔇 Additional comments (19)
src/BlazorUI/Bit.BlazorUI/Components/Buttons/BitActionButton/BitActionButton.razor (1)
34-34
: Ensure consistency of anchor attributes.
Including rel="@_rel" is a good practice for external links. Just confirm that it remains null or undefined if Href isn’t provided, preventing any unintended attributes. Everything else looks good here.
src/BlazorUI/Bit.BlazorUI/Components/Buttons/BitActionButton/BitActionButton.razor.cs (2)
7-7
: Private field naming.
_private string? rel; is clearly named. It's consistent with storing a string relationship value. No issues found.
185-195
: OnSetHrefAndRel logic review.
• The nullification of _rel for internal anchors (starting with '#') is sensible.
• The fallback to BitLinkRelUtils.GetRels(...) for external links is straightforward.
All logic looks correct.
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/BitActionButtonDemo.razor.samples.cs (8)
21-28
: Examples demonstrating the Rel property.
Displaying NoFollow and NoReferrer is helpful for demonstration. No issues found; usage is aligned with the new property.
29-29
: Renumbering example code.
The introduction of example4RazorCode is consistent with the preceding changes. No issues found.
81-81
: Size example reference.
Ensuring references to example5RazorCode is consistent with the rename. Looks good.
86-86
: Style & Class example reference.
Renumbering example6RazorCode. Straightforward change.
131-131
: Template example reference.
Renumbering to example7RazorCode. Maintains logical progression.
139-139
: Form example code referencing.
Renumbering to example8RazorCode. OK.
156-156
: Validation code referencing.
Renumbering to example8CsharpCode. No issues with the shift.
176-176
: RTL example code referencing.
Renumbering to example9RazorCode. Proper continuity in sample references.
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/BitActionButtonDemo.razor (7)
41-55
: New "Rel" example box.
Clear demonstration of external links, NoFollow, and NoReferrer usage. Great addition for explaining the new property’s benefits.
57-57
: Transition to Color example box.
Renaming the block’s ID is logical following the newly inserted Rel block.
152-152
: Size example box.
Updated to reference example5RazorCode. No issues, consistent with earlier file changes.
164-164
: Style & Class example box.
Updated to reference example6RazorCode. Maintains clarity in sample sets.
186-186
: Template example box.
Updated to reference example7RazorCode. Logical ordering.
201-201
: Button Type example box.
Updated to reference example8RazorCode. Demo alignments remain consistent.
233-233
: RTL example box.
Updated to reference example9RazorCode. No code issues identified.
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/BitActionButtonDemo.razor.cs (1)
346-431
: 🛠️ Refactor suggestion
Add the [Flags] attribute for flexible multi-rel combinations.
The enum values (1, 2, 4, 8, etc.) suggest a bitwise design. Consider marking this enum with the [Flags] attribute to allow combining multiple rel values (for example, "External | NoReferrer").
Below is a sample diff to illustrate:
+ [Flags]
public enum BitLinkRel
{
// ...
}
Likely invalid or redundant comment.
This closes #9524
Summary by CodeRabbit
New Features
rel
attribute for links in theBitActionButton
component to enhance accessibility and SEO.rel
attribute with different values.BitActionButtonDemo
to allow specification of link relationships for buttons.Documentation
BitActionButtonDemo
component.