|
1 |
| -@using Amazon.Lambda.TestTool.Utilities |
| 1 | +@using Amazon.Lambda.TestTool.Services |
| 2 | +@using Amazon.Lambda.TestTool.Utilities |
2 | 3 | @inherits LayoutComponentBase
|
3 | 4 |
|
| 5 | +@inject IJSRuntime Js |
| 6 | +@inject IThemeService ThemeService |
| 7 | + |
4 | 8 | <nav class="navbar navbar-expand-lg bd-navbar sticky-top bg-body-tertiary">
|
5 | 9 | <div class="container-fluid">
|
6 | 10 | <a class="navbar-brand py-0 me-4 d-flex align-items-center gap-3" href="/">
|
7 |
| - <img src="aws.svg" width="42" height="42" class="d-inline-block align-text-top"/> |
| 11 | + <img src="aws.svg" width="42" height="42" class="align-text-top logo-light-mode"/> |
| 12 | + <img src="aws-light.svg" width="42" height="42" class="align-text-top logo-dark-mode"/> |
8 | 13 | Lambda Test Tool
|
9 | 14 | </a>
|
10 | 15 | <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
|
30 | 35 | </NavLink>
|
31 | 36 | </li>
|
32 | 37 | </ul>
|
| 38 | + |
| 39 | + <ul class="navbar-nav flex-row flex-wrap ms-md-auto"> |
| 40 | + <li class="nav-item dropdown"> |
| 41 | + <button class="nav-link py-2 px-0 px-lg-2 dropdown-toggle d-flex align-items-center show" id="bd-theme" type="button" aria-expanded="true" data-bs-toggle="dropdown" data-bs-display="static" aria-label="Toggle theme (light)"> |
| 42 | + <i class="bi bi-palette-fill"></i> |
| 43 | + <span class="d-lg-none ms-2" id="bd-theme-text">Toggle theme</span> |
| 44 | + </button> |
| 45 | + <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="bd-theme-text" data-bs-popper="static"> |
| 46 | + <li> |
| 47 | + <button type="button" class="dropdown-item d-flex align-items-center gap-2" data-bs-theme-value="light" aria-pressed="true" @onclick="SetLightTheme"> |
| 48 | + <i class="bi bi-sun-fill"></i> |
| 49 | + Light |
| 50 | + </button> |
| 51 | + </li> |
| 52 | + <li> |
| 53 | + <button type="button" class="dropdown-item d-flex align-items-center gap-2" data-bs-theme-value="dark" aria-pressed="false" @onclick="SetDarkTheme"> |
| 54 | + <i class="bi bi-moon-stars-fill"></i> |
| 55 | + Dark |
| 56 | + </button> |
| 57 | + </li> |
| 58 | + </ul> |
| 59 | + </li> |
| 60 | + </ul> |
33 | 61 | </div>
|
34 | 62 | </div>
|
35 | 63 | </nav>
|
36 |
| -<div class="page"> |
| 64 | +<div class="page flex-grow-1"> |
37 | 65 | <main>
|
38 | 66 | <article class="content px-4">
|
39 | 67 | @Body
|
40 |
| - <hr /> |
41 |
| - <footer> |
42 |
| - <p>@Constants.ProductName (@Utils.DetermineToolVersion()) is an open source project. For issues or feedback visit the <a href="@Constants.LinkGithubTestTool">AWS Lambda for .NET Core GitHub repository.</a></p> |
43 |
| - </footer> |
44 | 68 | </article>
|
45 | 69 | </main>
|
46 | 70 | </div>
|
47 | 71 |
|
| 72 | +<footer class="footer text-muted p-3 mt-4"> |
| 73 | + <div class="d-flex container justify-content-center"> |
| 74 | + © @DateTime.Now.Year - AWS Lambda Test Tool |
| 75 | + </div> |
| 76 | +</footer> |
| 77 | + |
48 | 78 |
|
49 | 79 | <div id="blazor-error-ui">
|
50 | 80 | An unhandled error has occurred.
|
51 | 81 | <a href="" class="reload">Reload</a>
|
52 | 82 | <a class="dismiss">🗙</a>
|
53 | 83 | </div>
|
| 84 | + |
| 85 | +@code { |
| 86 | + |
| 87 | + protected override async Task OnAfterRenderAsync(bool firstRender) |
| 88 | + { |
| 89 | + if (string.IsNullOrEmpty(ThemeService.CurrentTheme)) |
| 90 | + { |
| 91 | + ThemeService.CurrentTheme = await Js.InvokeAsync<string>("getPreferredTheme"); |
| 92 | + } |
| 93 | + } |
| 94 | + |
| 95 | + private async Task SetLightTheme() |
| 96 | + { |
| 97 | + await SetTheme("light"); |
| 98 | + } |
| 99 | + |
| 100 | + private async Task SetDarkTheme() |
| 101 | + { |
| 102 | + await SetTheme("dark"); |
| 103 | + } |
| 104 | + |
| 105 | + private async Task SetTheme(string theme) |
| 106 | + { |
| 107 | + await Js.InvokeVoidAsync("setStoredTheme", theme); |
| 108 | + await Js.InvokeVoidAsync("setTheme", theme); |
| 109 | + ThemeService.CurrentTheme = theme; |
| 110 | + } |
| 111 | + |
| 112 | +} |
0 commit comments