-
Notifications
You must be signed in to change notification settings - Fork 468
Expand file tree
/
Copy pathApp.razor
More file actions
72 lines (62 loc) · 2.59 KB
/
App.razor
File metadata and controls
72 lines (62 loc) · 2.59 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
@*
⚠️ Do not modify this file without adapting FluentUI.Demo.Client/wwwroot/index.html
*@
@inject NavigationManager Navigation
<!DOCTYPE html>
<html lang="en">
@{
//var DemoRenderMode = new InteractiveWebAssemblyRenderMode(false);
var DemoRenderMode = new InteractiveServerRenderMode(false);
}
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<base href="/" />
<link rel="stylesheet" href="app.css" />
<link rel="stylesheet" href="@Assets["FluentUI.Demo.styles.css"]" />
<link rel="icon" type="image/x-icon" href="favicon.ico" />
<HeadOutlet @rendermode="@DemoRenderMode" />
<style>
/* Set the default dark mode styles,
used before the Fluent UI theme switcher is initialized
This is to avoid a flash of white when in dark mode.
Update as needed to match your dark theme.
*/
@@media (prefers-color-scheme: dark) {
body {
background-color: #292929;
color: #ffffff;
}
}
</style>
</head>
<body use-reboot="@reboot">
<Routes @rendermode="@DemoRenderMode" />
<script src="_framework/blazor.web.js"></script>
<!-- Include highlight.js -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.10.0/styles/vs.min.css" title="highlight-light" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.10.0/styles/vs2015.min.css" title="highlight-dark" disabled="disabled" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.10.0/highlight.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.10.0/languages/csharp.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/highlightjs-cshtml-razor@2.1.1/dist/cshtml-razor.min.js"></script>
<script>
// Listen for the theme change event and toggle highlight.js styles
document.body.addEventListener('themeChanged', function (e) {
const linkLight = document.querySelector('link[title="highlight-light"]');
const linkDark = document.querySelector('link[title="highlight-dark"]');
if (linkLight && linkDark) {
linkLight.disabled = e.detail.isDark;
linkDark.disabled = !e.detail.isDark;
}
});
</script>
</body>
</html>
@code
{
bool reboot = false;
protected override void OnInitialized()
{
reboot = new Uri(Navigation.Uri).Query.Contains("reboot", StringComparison.InvariantCultureIgnoreCase);
}
}