Skip to content

Commit b1ca90b

Browse files
authored
Merge pull request #2 from neozhu/dev
Dev
2 parents aaa4c65 + fa194b7 commit b1ca90b

File tree

11 files changed

+80
-108
lines changed

11 files changed

+80
-108
lines changed

doc/2022-02-11_19-34-31.png

182 KB
Loading

doc/2022-02-11_19-44-40.png

131 KB
Loading

doc/2022-02-11_19-44-59.png

142 KB
Loading

doc/2022-02-11_19-45-22.png

161 KB
Loading

src/Blazor.Server.UI/Components/Shared/NavMenu.razor

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@
2929
<MudIconButton Class="mx-1"
3030
Color="Color.Default"
3131
Icon="@Icons.Custom.Brands.GitHub"
32-
Link="https://github.com/neozhu/MudDemo"
32+
Link="https://github.com/neozhu/CleanArchitectureWithBlazorServer"
3333
Target="_blank" />
3434
</MudTooltip>
3535
<LanguageSelector />
36+
37+
3638
<NotificationMenu Class="mx-1"
3739
Notifications="_activeNotifications" />
3840
<MudTooltip Text="@(RightToLeft?"Toggle right-to-left":"Toggle left-to-right")">
Lines changed: 25 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,30 @@
11
@inherits MudComponentBase
22
@inject IStringLocalizer<NotificationMenu> L
3-
<MudElement @attributes="@UserAttributes"
4-
Class="@Classname"
5-
Style="@Style">
6-
<MudMenu AnchorOrigin="Origin.BottomRight"
7-
LockScroll="true"
8-
TransformOrigin="Origin.TopRight">
9-
<ActivatorContent>
10-
<MudTooltip Arrow="true"
11-
Text="Notifications">
12-
@if (Notifications != null)
13-
{
14-
<MudBadge BadgeClass="notification-badge"
15-
Color="Color.Error"
16-
Content="Notifications.Count()"
17-
Overlap="true"
18-
Visible="Notifications.Any()">
19-
<MudIconButton Color="Color.Default"
20-
Icon="@Icons.Material.Filled.Notifications" />
21-
</MudBadge>
22-
}
23-
</MudTooltip>
24-
</ActivatorContent>
25-
<ChildContent>
26-
<div class="pb-2 pt-4"
27-
style="min-width: 330px">
28-
<MudText Class="pb-2 px-6"
29-
Typo="Typo.body2">
30-
<b>@(L["Notifications"])</b>
31-
</MudText>
32-
<MudDivider Class="my-2" />
33-
@if (Notifications != null && Notifications.Any())
34-
{
35-
@foreach (var notification in Notifications)
36-
{
37-
<MudMenuItem>
38-
<div class="d-flex">
39-
<div class="mr-4">
40-
<MudAvatar Color="Color.Inherit"
41-
Variant="Variant.Filled">
42-
<MudIcon Icon="@notification.NotificationIcon" />
43-
</MudAvatar>
44-
</div>
45-
<div>
46-
<MudText Typo="Typo.body2">@notification.Message</MudText>
47-
<div class="align-center d-flex">
48-
<MudIcon Class="mr-1"
49-
Color="Color.Default"
50-
Icon="@Icons.Material.Filled.AccessTime"
51-
Style="font-size: 13px" />
52-
<MudText Typo="Typo.caption">@notification.TimeSinceEventFormatted</MudText>
53-
</div>
54-
</div>
55-
</div>
56-
</MudMenuItem>
57-
}
58-
}
59-
else
60-
{
61-
<MudText Class="px-6 py-3"
62-
Typo="Typo.body2">
63-
@(L["You have no unread notifications."])
64-
</MudText>
65-
}
66-
<MudDivider Class="my-2" />
67-
<div class="mt-4 mx-4">
68-
<MudButton Color="Color.Primary"
69-
FullWidth="true"
70-
OnClick="OnClickViewAll"
71-
Style="text-transform:none"
72-
Variant="Variant.Text">
73-
@(L["View All"])
74-
</MudButton>
75-
</div>
3+
4+
<MudBadge Color="Color.Secondary" Dot="true" Overlap="true" Visible="_newNotificationsAvailable">
5+
<MudMenu Icon="@Icons.Outlined.Notifications" AnchorOrigin="Origin.BottomLeft" TransformOrigin="Origin.TopCenter" PopoverClass="docs-layout-menu-shadow" ListClass="pa-2 docs-menu-list" LockScroll="true">
6+
<div class="d-flex justify-space-between align-center px-2">
7+
<MudText Typo="Typo.subtitle2">Notifications</MudText>
8+
<MudButton Disabled="@(_newNotificationsAvailable == false)" OnClick="MarkNotificationAsRead" StartIcon="@Icons.Filled.DoneAll" Variant="Variant.Text" Color="Color.Primary" Class="ml-16 mr-n2">Mark as read</MudButton>
9+
</div>
10+
@if (Notifications != null && _newNotificationsAvailable)
11+
{
12+
@foreach (var notification in Notifications.Take(5))
13+
{
14+
<MudMenuItem Class="px-2 py-0 rounded">
15+
<MudText Typo="Typo.subtitle2">@notification.Message</MudText>
16+
<MudText Typo="Typo.body2">@($"{notification.TimeSinceEventFormatted}")</MudText>
17+
</MudMenuItem>
18+
<MudDivider Class="my-2"/>
19+
}
20+
}
21+
else
22+
{
23+
<div class="d-flex justify-center align-center px-2 py-8 relative">
24+
<MudText Class="mud-text-secondary my-12">Nothing new :(</MudText>
25+
<MudBlazorLogo Class="docs-logo-filter mx-16 absolute"/>
7626
</div>
77-
</ChildContent>
27+
}
7828
</MudMenu>
79-
</MudElement>
29+
</MudBadge>
8030

81-
<style>
82-
83-
.notification-badge{
84-
margin-left: -10px;
85-
margin-bottom: -8px;
86-
}
87-
88-
</style>

src/Blazor.Server.UI/Components/Shared/NotificationMenu.razor.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ public partial class NotificationMenu : MudComponentBase
1313
new CssBuilder()
1414
.AddClass(Class)
1515
.Build();
16-
16+
1717
[Parameter] public IEnumerable<NotificationModel>? Notifications { get; set; }
1818
[Parameter] public EventCallback<MouseEventArgs> OnClickViewAll { get; set; }
19+
20+
private bool _newNotificationsAvailable => Notifications != null && Notifications.Any();
21+
22+
private void MarkNotificationAsRead() => Notifications = null;
1923
}

src/Blazor.Server.UI/Pages/Identity/Roles/Roles.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@
222222
};
223223
var parameters = new DialogParameters { ["model"] = model };
224224
var options = new DialogOptions { CloseOnEscapeKey = true, MaxWidth = MaxWidth.Small, FullWidth = true };
225-
var dialog = DialogService.Show<_RoleFormDialog>(L["Create a new role"], parameters, options);
225+
var dialog = DialogService.Show<_RoleFormDialog>(L["Edit the role"], parameters, options);
226226
var result = await dialog.Result;
227227
if (!result.Cancelled)
228228
{

src/Blazor.Server.UI/Shared/MainLayout.razor.cs

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,8 @@ public partial class MainLayout : IDisposable
3939
{
4040
Primary = "#2d4275",
4141
Black = "#0A0E19",
42-
//Tertiary = "#00B5E2",
4342
Success = "#64A70B",
44-
Secondary = "#728BC9",
45-
//Info = "#2879A8"
43+
Secondary = "#ff4081ff",
4644
};
4745
private readonly MudTheme _theme = new()
4846
{
@@ -114,49 +112,52 @@ public partial class MainLayout : IDisposable
114112
{
115113
FontSize = "3rem",
116114
FontWeight = 600,
117-
LineHeight = 1.8,
115+
LineHeight = 1.167,
118116
LetterSpacing = "0"
119117
},
120118
H4 = new H4
121119
{
122120
FontSize = "1.8rem",
123-
FontWeight = 700,
121+
FontWeight = 400,
124122
LineHeight = 1.235,
125-
LetterSpacing = ".007em"
123+
LetterSpacing = ".00735em"
126124
},
127125
H5 = new H5
128126
{
129-
FontSize = "1.8rem",
130-
FontWeight = 700,
131-
LineHeight = 2,
127+
FontSize = "1.5rem",
128+
FontWeight = 400,
129+
LineHeight = 1.334,
132130
LetterSpacing = "0"
133131
},
134132
H6 = new H6
135133
{
136134
FontSize = "1.125rem",
137-
FontWeight = 700,
138-
LineHeight = 2,
135+
FontWeight = 600,
136+
LineHeight =1.6,
139137
LetterSpacing = ".0075em"
140138
},
141139
Button = new Button
142140
{
143141
FontSize = ".875rem",
144142
FontWeight = 500,
145143
LineHeight = 1.75,
146-
LetterSpacing = ".02857em"
144+
LetterSpacing = ".02857em",
145+
TextTransform = "none"
146+
147+
147148
},
148149
Subtitle1 = new Subtitle1
149150
{
150-
FontSize = "1.1rem",
151-
FontWeight = 500,
151+
FontSize = "1rem",
152+
FontWeight = 400,
152153
LineHeight = 1.75,
153154
LetterSpacing = ".00938em"
154155
},
155156
Subtitle2 = new Subtitle2
156157
{
157-
FontSize = "1rem",
158-
FontWeight = 600,
159-
LineHeight = 1.8,
158+
FontSize = ".875rem",
159+
FontWeight = 500,
160+
LineHeight = 1.57,
160161
LetterSpacing = ".00714em"
161162
},
162163
Body1 = new Body1
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
@namespace Blazor.Server.UI.Shared
2+
3+
<svg viewBox="0 0 1653 1049" xmlns="http://www.w3.org/2000/svg" class="@Class" style="@Style">
4+
<path fill="#7467EF" d="M0.15,572.58V0.16L495.9,286.37v190.81L165.4,286.37v381.62L0.15,572.58z" />
5+
<path fill="#594AE2" d="M495.9,286.37L991.65,0.16v572.43l-330.5,190.81l-165.25-95.4l330.5-190.81V286.37L495.9,477.18V286.37z" />
6+
<path fill="#7467EF" d="M495.9,667.99V858.8l330.5,190.81V858.8L495.9,667.99z" />
7+
<path fill="#594AE2" d="M826.4,1049.6l495.75-286.21V0.37l-165.25,95.4v572.21L826.4,858.8V1049.6z" />
8+
<path fill="#7467ef" d="M1495,467.85l-165.25,95.41,157.47,91.52,165.25-95.38Z" />
9+
<path fill="#7467EF" d="M1322.15,763.39l-165.25,95.4l330.5,190.81V858.8L1322.15,763.39z" />
10+
<path fill="#7467EF" d="M1322.13,0.38l-165.25,95.4l330.29,190.83l165.25-95.38L1322.13,0.38z" />
11+
<path fill="#594AE2" d="M1652.43,191.21l-165.25,95.41v762.99l165.25-95.4L1652.43,191.21z" />
12+
</svg>
13+
14+
15+
@code {
16+
[Parameter] public string Style { get; set; }
17+
[Parameter] public string Class { get; set; }
18+
}

0 commit comments

Comments
 (0)