Skip to content

Commit a68d9bb

Browse files
authored
fix(DateTimePicker): width overflow when set ViewMode to DateTime (dotnetcore#6590)
1 parent 7ca524e commit a68d9bb

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/BootstrapBlazor/Components/DateTimePicker/DatePickerBody.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<i class="@PreviousMonthIcon"></i>
3838
</button>
3939
}
40-
<div class="d-flex align-items-center justify-content-center flex-fill">
40+
<div class="@HeaderLabelString">
4141
<span role="button" class="picker-panel-header-label" @onclick="() => SwitchView(DatePickerViewMode.Year)">@YearString</span>
4242
<span role="button" class="@CurrentMonthViewClassName" @onclick="() => SwitchView(DatePickerViewMode.Month)">@MonthString</span>
4343
@if (IsDateTimeMode)

src/BootstrapBlazor/Components/DateTimePicker/DatePickerBody.razor.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,10 @@ public bool AllowNull
465465

466466
private bool IsDateTimeMode => ViewMode == DatePickerViewMode.DateTime && CurrentViewMode == DatePickerViewMode.DateTime;
467467

468+
private string? HeaderLabelString => CssBuilder.Default("d-flex align-items-center justify-content-center flex-fill")
469+
.AddClass("picker-panel-header-bar", ViewMode == DatePickerViewMode.DateTime)
470+
.Build();
471+
468472
private readonly Dictionary<string, List<DateTime>> _monthDisabledDaysCache = [];
469473

470474
/// <summary>

src/BootstrapBlazor/Components/DateTimePicker/DatePickerBody.razor.scss

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.picker-panel {
1+
.picker-panel {
22
--bb-picker-panel-body-width: 320px;
33
--bb-picker-hover-color: #409eff;
44
--bb-picker-panel-side-width: 0;
@@ -62,6 +62,12 @@
6262
}
6363
}
6464

65+
.picker-panel-header-bar {
66+
.picker-panel-header-label {
67+
font-size: 14px;
68+
}
69+
}
70+
6571
.picker-panel-header-label {
6672
font-size: 16px;
6773
font-weight: 500;

0 commit comments

Comments
 (0)