Skip to content

Commit 3c0d751

Browse files
committed
make prompt modal draggable in Boilerplate #10972
1 parent b335bee commit 3c0d751

File tree

3 files changed

+37
-41
lines changed

3 files changed

+37
-41
lines changed
Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
@inherits AppComponentBase
22

33
<section>
4-
<BitStack Class="stack">
5-
<BitStack Horizontal AutoHeight>
4+
<BitStack Gap="0">
5+
<BitStack Horizontal AutoHeight Class="header-stack">
66
<BitText Typography="BitTypography.H5" Color="BitColor.Tertiary">
77
@Title
88
</BitText>
@@ -15,35 +15,33 @@
1515
IconName="@BitIconName.ChromeClose" />
1616
</BitStack>
1717

18-
<div class="body">
19-
<BitStack HorizontalAlign="BitAlignment.Center">
20-
<BitText Color="BitColor.Tertiary" Style="white-space:break-spaces;max-width:500px;">
21-
@Body
22-
</BitText>
23-
@if (OtpInput)
24-
{
25-
<BitOtpInput @bind-Value="value"
26-
AutoFocus
27-
Length="6"
28-
Size="BitSize.Large"
29-
Type="BitInputType.Number"
30-
Style="justify-content:center"
31-
OnFill="WrapHandled(async (string? otp) => OnOk?.Invoke(value))" />
32-
}
33-
else
34-
{
35-
<BitTextField @bind-Value="value"
36-
AutoFocus
37-
Immediate
38-
OnEnter="WrapHandled(async (KeyboardEventArgs args) => OnOk?.Invoke(value))" />
39-
}
40-
</BitStack>
41-
</div>
18+
<BitStack HorizontalAlign="BitAlignment.Center" Class="stack">
19+
<BitText Color="BitColor.Tertiary" Style="white-space:break-spaces;max-width:500px;">
20+
@Body
21+
</BitText>
22+
@if (OtpInput)
23+
{
24+
<BitOtpInput @bind-Value="value"
25+
AutoFocus
26+
Length="6"
27+
Size="BitSize.Large"
28+
Type="BitInputType.Number"
29+
Style="justify-content:center"
30+
OnFill="WrapHandled(async (string? otp) => OnOk?.Invoke(value))" />
31+
}
32+
else
33+
{
34+
<BitTextField @bind-Value="value"
35+
AutoFocus
36+
Immediate
37+
OnEnter="WrapHandled(async (KeyboardEventArgs args) => OnOk?.Invoke(value))" />
38+
}
4239

43-
<BitStack Alignment="BitAlignment.Center" AutoHeight>
44-
<BitButton OnClick="OnOkClick" Color="BitColor.Tertiary">
45-
@Localizer[nameof(AppStrings.Ok)]
46-
</BitButton>
40+
<BitStack Alignment="BitAlignment.Center" AutoHeight>
41+
<BitButton OnClick="OnOkClick" Color="BitColor.Tertiary">
42+
@Localizer[nameof(AppStrings.Ok)]
43+
</BitButton>
44+
</BitStack>
4745
</BitStack>
4846
</BitStack>
4947
</section>

src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Common/Prompt.razor.scss

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,21 @@
22
@import '../../Styles/abstracts/_bit-css-variables.scss';
33

44
section {
5-
padding: 1rem;
65
min-width: 20rem;
76
max-height: $bit-env-height-available;
87

9-
@include lt-md {
8+
@include lt-sm {
109
min-width: unset;
1110
}
1211
}
1312

14-
.body {
15-
width: 100%;
16-
flex-grow: 1;
17-
display: flex;
18-
overflow: auto;
19-
white-space: pre;
20-
}
21-
2213
::deep {
14+
.header-stack {
15+
padding: 1rem;
16+
}
17+
2318
.stack {
24-
max-height: calc(#{$bit-env-height-available} - 3rem);
19+
padding: 1rem;
20+
padding-top: 0;
2521
}
2622
}

src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Services/PromptService.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ public partial class PromptService
2020
};
2121
var modalParameters = new BitModalParameters()
2222
{
23+
Draggable = true,
24+
DragElementSelector = ".header-stack",
2325
OnOverlayClick = EventCallback.Factory.Create<MouseEventArgs>(this, () => tcs.SetResult(null))
2426
};
2527
modalReference = await modalService.Show<Prompt>(promptParameters, modalParameters);

0 commit comments

Comments
 (0)