-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSheetContentTemplate.cs
More file actions
45 lines (39 loc) · 1.45 KB
/
SheetContentTemplate.cs
File metadata and controls
45 lines (39 loc) · 1.45 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
using ShellUI.Core.Models;
namespace ShellUI.Templates.Templates;
public class SheetContentTemplate
{
public static ComponentMetadata Metadata => new()
{
Name = "sheet-content",
DisplayName = "Sheet Content",
Description = "Content subcomponent for the compositional Sheet pattern",
Category = ComponentCategory.Overlay,
FilePath = "SheetContent.razor",
IsAvailable = false,
Dependencies = new List<string>(),
Tags = new List<string> { "overlay", "sheet", "content" }
};
public static string Content => @"@namespace YourProjectNamespace.Components.UI
@using YourProjectNamespace.Components.UI.Variants
@if (Parent?.Open == true)
{
<div class=""fixed inset-0 z-50 bg-background/80 backdrop-blur-sm animate-in fade-in-0"" @onclick=""Close""></div>
<div class=""@SheetVariants.Get(Parent.Side, Class)"" @onclick:stopPropagation=""true"" @attributes=""AdditionalAttributes"">
<div class=""flex flex-col gap-4 p-6"">
@ChildContent
</div>
</div>
}
@code {
[CascadingParameter] private Sheet? Parent { get; set; }
[Parameter] public RenderFragment? ChildContent { get; set; }
[Parameter] public string? Class { get; set; }
[Parameter(CaptureUnmatchedValues = true)]
public Dictionary<string, object>? AdditionalAttributes { get; set; }
private async Task Close()
{
if (Parent != null) await Parent.SetOpen(false);
}
}
";
}