Skip to content

Commit

Permalink
#115 chore: display themes ordered and add Theme after each name
Browse files Browse the repository at this point in the history
  • Loading branch information
joseantmazonsb committed Mar 17, 2022
1 parent a5f38f3 commit b93d4a1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Linguard/Web/Pages/_Host.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

@section styles {
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css"/>
<link id="linguard_style" rel="stylesheet" media="screen" href="@Model?.Stylesheet" >
<link id="linguard_style" rel="stylesheet" media="screen" href="@HostModel.Stylesheet" >
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css"
integrity="sha512-9usAa10IRO0HhonpyAIVpjrylPvoDwiPUiKdWk5t3PyolY1cOd4DSE0Ga+ri4AuTroPR5aQvXU9xC6qOPnzFeg=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
Expand Down
2 changes: 1 addition & 1 deletion Linguard/Web/Pages/_Host.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ public HostModel(IConfigurationManager configurationManager) {
}

private IWebConfiguration Configuration => _configurationManager.Configuration.Web;
public string Stylesheet => $"_content/Radzen.Blazor/css/{Style.Default}.css";
public static string Stylesheet => $"_content/Radzen.Blazor/css/{Style.Default}.css";

}
7 changes: 4 additions & 3 deletions Linguard/Web/Shared/ProfileMenu.razor
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
@using Microsoft.Extensions.Options
<div class="d-flex align-items-center justify-content-end">
<RadzenDropDown TValue="string" AllowClear="false" class="mx-0 mx-lg-3"
Data="@Enum.GetNames(typeof(Style)).Select(s => s.ToString())"
Value="Style.Default.ToString()"
Data="@(Enum.GetNames(typeof(Style)).Select(s => $"{s} Theme").OrderBy(s => s))"
Value="@($"{Style.Default} Theme")"
ValueChanged="OnStyleChanged">
</RadzenDropDown>
<RadzenProfileMenu class="text-end" Click="MenuClick">
Expand Down Expand Up @@ -35,7 +35,8 @@
string GreetingMessage => $"Hi, {_user}";
string GravatarEmail => _email ?? "[email protected]";

async Task OnStyleChanged(string styleName) {
async Task OnStyleChanged(string value) {
var styleName = value.Split(" ").First();
var style = Enum.Parse<Style>(styleName);
await _jsRuntime.InvokeVoidAsync("setStylesheet",
StyleUtils.GetStylesheet(style));
Expand Down

0 comments on commit b93d4a1

Please sign in to comment.