Skip to content
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

Improve NavMenu of BlazorUI demo (#8522) #8523

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
</ExamplePreview>
</ComponentExampleBox>

<ComponentExampleBox Title="Suggest List" RazorCode="@example8RazorCode" CsharpCode="@example8CsharpCode" Id="example8">
<ComponentExampleBox Title="Suggestion (AutoComplete)" RazorCode="@example8RazorCode" CsharpCode="@example8CsharpCode" Id="example8">
<ExamplePreview>
<div>Examples of BitSearchBox with suggestion list, including custom filtering, minimum trigger characters, and more.</div>
<br /><br /><br />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ public partial class NavMenu : IDisposable
new() { Text = "Calendar", Url = "/components/calendar" },
new() { Text = "Checkbox", Url = "/components/checkbox", AdditionalUrls = ["/components/check-box"] },
new() { Text = "ChoiceGroup", Url = "/components/choicegroup", AdditionalUrls = ["/components/choice-group"], Description = "Radio, RadioButton" },
new() { Text = "Dropdown", Url = "/components/dropdown", Description = "Select, MultiSelect, ComboBox" },
new() { Text = "Dropdown", Url = "/components/dropdown", Description = "Select, MultiSelect, ComboBox", Data = "Chips" },
new() { Text = "FileUpload", Url = "/components/fileupload", AdditionalUrls = ["/components/file-upload"] },
new() { Text = "NumberField", Url = "/components/numberfield", AdditionalUrls = ["/components/numerictextfield", "/components/numeric-text-field"], Description = "NumberInput" },
new() { Text = "OtpInput", Url = "/components/otpinput", AdditionalUrls = ["/components/otp-input"] },
new() { Text = "Rating", Url = "/components/rating" },
new() { Text = "SearchBox", Url = "/components/searchbox", AdditionalUrls = ["/components/search-box"] },
new() { Text = "SearchBox", Url = "/components/searchbox", AdditionalUrls = ["/components/search-box"], Data = "AutoComplete" },
new() { Text = "Slider", Url = "/components/slider", Description = "Range" },
new() { Text = "SpinButton", Url = "/components/spinbutton", AdditionalUrls = ["/components/spin-button"] },
new() { Text = "TextField", Url = "/components/textfield", AdditionalUrls = ["/components/text-field"], Description = "TextInput" },
Expand Down Expand Up @@ -65,7 +65,7 @@ public partial class NavMenu : IDisposable
new() { Text = "Header", Url = "/components/header" },
new() { Text = "Layout", Url = "/components/layout" },
new() { Text = "Spacer", Url = "/components/spacer" },
new() { Text = "Stack", Url = "/components/stack" },
new() { Text = "Stack", Url = "/components/stack", Description = "WrapPanel" },
],
},
new()
Expand Down Expand Up @@ -201,7 +201,17 @@ private void HandleChange(string text)
_filteredNavItems = _allNavItems;
if (string.IsNullOrEmpty(text)) return;

_filteredNavItems = _flatNavItemList.FindAll(item => text.Split(' ').Where(t => t.HasValue()).Any(t => $"{item.Text} {item.Description}".Contains(t, StringComparison.InvariantCultureIgnoreCase)));
var mainItems = _flatNavItemList
.FindAll(item => text.Split(' ')
.Where(t => t.HasValue())
.Any(t => $"{item.Text} {item.Description}".Contains(t, StringComparison.InvariantCultureIgnoreCase)));

var subItems = _flatNavItemList
.FindAll(item => text.Split(' ')
.Where(t => t.HasValue())
.Any(t => item.Data?.ToString()?.Contains(t, StringComparison.InvariantCultureIgnoreCase) ?? false));

_filteredNavItems = [.. mainItems, .. subItems];
}

private async Task HandleOnItemClick(BitNavItem item)
Expand Down
Loading