Skip to content

Commit

Permalink
Merge pull request #34 from Zikirooo/feature/langnavborder
Browse files Browse the repository at this point in the history
#32 Make LanguageNavTagHelper border optional
  • Loading branch information
LazZiya authored Oct 9, 2023
2 parents 77fc85d + cc09f42 commit f7e9e95
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
15 changes: 13 additions & 2 deletions LazZiya.TagHelpers/LanguageNavTagHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;

namespace LazZiya.TagHelpers
{
Expand Down Expand Up @@ -67,6 +68,11 @@ public class LanguageNavTagHelper : TagHelper
/// </summary>
public bool FlagsSquared { get; set; } = false;

/// <summary>
/// Whether show border or not
/// </summary>
public bool Border { get; set; } = true;

/// <summary>
/// required for listing supported cultures.
/// The handler must contain two place holders for culture name and return url.
Expand Down Expand Up @@ -327,12 +333,17 @@ private string GetLanguageLabel(CultureInfo cul)
private TagBuilder CreateToggle()
{
var toggle = new TagBuilder("a");
toggle.AddCssClass("btn-sm btn-default border border-secondary dropdown-toggle");

var cssBuilder = new StringBuilder("btn-sm btn-default border-secondary dropdown-toggle");

if (Border) cssBuilder.Append(" border");
toggle.AddCssClass(cssBuilder.ToString());

toggle.Attributes.Add("id", "dropdownLang");
toggle.Attributes.Add("href", "#");
toggle.Attributes.Add("role", "button");

if(RenderMode == RenderMode.Bootstrap5)
if (RenderMode == RenderMode.Bootstrap5)
toggle.Attributes.Add("data-bs-toggle", "dropdown");
else
toggle.Attributes.Add("data-toggle", "dropdown");
Expand Down
6 changes: 5 additions & 1 deletion LazZiya.TagHelpers/LazZiya.TagHelpers.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f7e9e95

Please sign in to comment.