Skip to content

Commit

Permalink
🐛 fix(Drawer): BodyStyle doesn't work (#2003)
Browse files Browse the repository at this point in the history
  • Loading branch information
capdiem authored Jul 1, 2024
1 parent 7d48db6 commit af96e03
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/Masa.Blazor/Presets/Drawer/PDrawer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,16 @@ public override async Task SetParametersAsync(ParameterView parameters)

protected override void OnParametersSet()
{
BodyStyle = $"overflow-y: auto;padding: 24px;{ComputedContentHeight}";

Transition = ComputedTransition;

base.OnParametersSet();
}

protected override string GetBodyStyle()
{
return StyleBuilder.Create().Add("overflow-y: auto; padding: 24px")
.Add(ComputedContentHeight)
.Add(BodyStyle)
.ToString();
}
}
2 changes: 1 addition & 1 deletion src/Masa.Blazor/Presets/Modal/ModalBase.razor
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
}

<MCardText Class="@BodyClass"
Style="@($"padding: 24px; {BodyStyle}")"
Style="@GetBodyStyle()"
@ref="BodyRef">
@if (FormModel == null)
{
Expand Down
5 changes: 5 additions & 0 deletions src/Masa.Blazor/Presets/Modal/ModalBase.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,11 @@ private async Task InternalValueChanged(bool value)
Text = true,
};

protected virtual string GetBodyStyle()
{
return StyleBuilder.Create().Add("padding: 24px").Add(BodyStyle).ToString();
}

private async Task ScrollToTop()
{
if (AutoScrollToTop && BodyRef?.Ref != null)
Expand Down

0 comments on commit af96e03

Please sign in to comment.