forked from dotnet/eShop
-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathHeaderBar.razor
More file actions
34 lines (30 loc) · 1.25 KB
/
HeaderBar.razor
File metadata and controls
34 lines (30 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
@using Microsoft.AspNetCore.Components.Endpoints
<div class="eshop-header @(IsCatalog? "home" : "")">
<div class="eshop-header-hero">
@{
var headerImage = IsCatalog ? "images/header-home.webp" : "images/header.webp";
}
<img role="presentation" src="@headerImage" />
</div>
<div class="eshop-header-container">
<nav class="eshop-header-navbar">
<a class="logo logo-header" href="">
<img alt="AdventureWorks" src="images/logo-header.svg" class="logo logo-header" />
</a>
<ThemeToggle />
<UserMenu />
<CartMenu />
</nav>
<div class="eshop-header-intro">
<h1><SectionOutlet SectionName="page-header-title" /></h1>
<p><SectionOutlet SectionName="page-header-subtitle" /></p>
</div>
</div>
</div>
@code {
[CascadingParameter]
public HttpContext? HttpContext { get; set; }
// We can use Endpoint Metadata to determine the page currently being visited
private Type? PageComponentType => HttpContext?.GetEndpoint()?.Metadata.OfType<ComponentTypeMetadata>().FirstOrDefault()?.Type;
private bool IsCatalog => PageComponentType == typeof(Pages.Catalog.Catalog);
}