Skip to content

Commit e5a9c77

Browse files
committed
fix: ensure Title is displayed correctly in Sheet component and add fallback for empty Title
1 parent c6580f9 commit e5a9c77

File tree

2 files changed

+30
-22
lines changed

2 files changed

+30
-22
lines changed

NET9/BlazorInteractiveServer/Components/UI/Sheet.razor

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,22 @@ else if (Open)
1212
<div class="fixed inset-0 z-50 bg-background/80 backdrop-blur-sm animate-in fade-in-0" @onclick="Close"></div>
1313
<div class="@SheetVariants.Get(Side, Class)" @onclick:stopPropagation="true" @attributes="AdditionalAttributes">
1414
<div class="flex flex-col space-y-2">
15-
@if (!string.IsNullOrEmpty(Title))
16-
{
17-
<div class="flex items-center justify-between">
15+
<div class="flex items-center justify-between">
16+
@if (!string.IsNullOrEmpty(Title))
17+
{
1818
<h2 class="text-lg font-semibold text-foreground">@Title</h2>
19-
<button type="button" @onclick="Close" class="rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none">
20-
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
21-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
22-
</svg>
23-
<span class="sr-only">Close</span>
24-
</button>
25-
</div>
26-
}
19+
}
20+
else
21+
{
22+
<span></span>
23+
}
24+
<button type="button" @onclick="Close" class="rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none">
25+
<svg class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
26+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
27+
</svg>
28+
<span class="sr-only">Close</span>
29+
</button>
30+
</div>
2731
@if (!string.IsNullOrEmpty(Description))
2832
{
2933
<p class="text-sm text-muted-foreground">@Description</p>

src/ShellUI.Templates/Templates/SheetTemplate.cs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,22 @@ @using YourProjectNamespace.Components.UI.Variants
2929
<div class=""fixed inset-0 z-50 bg-background/80 backdrop-blur-sm animate-in fade-in-0"" @onclick=""Close""></div>
3030
<div class=""@SheetVariants.Get(Side, Class)"" @onclick:stopPropagation=""true"" @attributes=""AdditionalAttributes"">
3131
<div class=""flex flex-col space-y-2"">
32-
@if (!string.IsNullOrEmpty(Title))
33-
{
34-
<div class=""flex items-center justify-between"">
32+
<div class=""flex items-center justify-between"">
33+
@if (!string.IsNullOrEmpty(Title))
34+
{
3535
<h2 class=""text-lg font-semibold text-foreground"">@Title</h2>
36-
<button type=""button"" @onclick=""Close"" class=""rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none"">
37-
<svg class=""h-4 w-4"" fill=""none"" viewBox=""0 0 24 24"" stroke=""currentColor"">
38-
<path stroke-linecap=""round"" stroke-linejoin=""round"" stroke-width=""2"" d=""M6 18L18 6M6 6l12 12"" />
39-
</svg>
40-
<span class=""sr-only"">Close</span>
41-
</button>
42-
</div>
43-
}
36+
}
37+
else
38+
{
39+
<span></span>
40+
}
41+
<button type=""button"" @onclick=""Close"" class=""rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none"">
42+
<svg class=""h-4 w-4"" fill=""none"" viewBox=""0 0 24 24"" stroke=""currentColor"">
43+
<path stroke-linecap=""round"" stroke-linejoin=""round"" stroke-width=""2"" d=""M6 18L18 6M6 6l12 12"" />
44+
</svg>
45+
<span class=""sr-only"">Close</span>
46+
</button>
47+
</div>
4448
@if (!string.IsNullOrEmpty(Description))
4549
{
4650
<p class=""text-sm text-muted-foreground"">@Description</p>

0 commit comments

Comments
 (0)