Skip to content

Commit 8ddc503

Browse files
committed
refactor: 改用 grid 布局
1 parent de7fe2c commit 8ddc503

File tree

3 files changed

+12
-29
lines changed

3 files changed

+12
-29
lines changed

src/BootstrapBlazor/Components/ListView/ListView.razor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public partial class ListView<TItem> : BootstrapComponentBase
1515
.AddClassFromAttributes(AdditionalAttributes)
1616
.Build();
1717

18-
private string? BodyClassString => CssBuilder.Default("listview-body")
18+
private string? BodyClassString => CssBuilder.Default("listview-body scroll")
1919
.AddClass("is-group", GroupName != null)
2020
.Build();
2121

src/BootstrapBlazor/Components/ListView/ListView.razor.scss

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
--bb-lv-item-border-hover-color: #{$bb-lv-item-border-hover-color};
77
--bb-lv-item-shadow: #{$bb-lv-item-shadow};
88
--bb-lv-body-padding: #{$bb-lv-body-padding};
9-
--bb-lv-body-item-margin: #{$bb-lv-body-item-margin};
9+
--bb-lv-body-item-gap: #{$bb-lv-body-item-gap};
1010
--bb-lv-footer-padding: #{$bb-lv-footer-padding};
1111
border: 1px solid var(--bb-lv-border-color);
1212
border-radius: var(--bs-border-radius);
@@ -29,24 +29,17 @@
2929
.listview .listview-body {
3030
padding: var(--bb-lv-body-padding);
3131
position: relative;
32-
overflow: auto;
33-
display: flex;
34-
flex-flow: row wrap;
3532
flex: 1;
36-
align-content: flex-start;
37-
height: 1%;
3833
min-height: 0;
34+
height: 1%;
3935
}
4036

4137
.listview .listview-body.is-group {
4238
padding: 0;
4339
}
4440

45-
.listview .listview-body .listview-item {
46-
margin: var(--bb-lv-body-item-margin);
47-
}
48-
4941
.listview .listview-body .listview-item .card {
42+
box-shadow: var(--bb-lv-item-shadow);
5043
transition: var(--bb-lv-item-trans);
5144
}
5245

@@ -55,15 +48,11 @@
5548
border: 1px solid var(--bb-lv-item-border-hover-color);
5649
}
5750

58-
.listview .listview-body .listview-item .card {
59-
box-shadow: var(--bb-lv-item-shadow);
60-
}
61-
62-
.listview .listview-body .listview-item-group {
63-
flex-basis: 100%;
64-
margin: 1rem 0;
65-
font-weight: bold;
66-
position: relative;
51+
.listview .listview-item-group {
52+
display: grid;
53+
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
54+
gap: var(--bb-lv-body-item-gap);
55+
align-items: start;
6756
}
6857

6958
.listview .listview-body .accordion {
@@ -82,15 +71,9 @@
8271
}
8372

8473
.listview .listview-body .accordion-body {
85-
display: flex;
86-
flex-wrap: wrap;
8774
padding: var(--bb-lv-body-padding);
8875
}
8976

90-
.listview .listview-body .accordion-item {
91-
width: 100%;
92-
}
93-
9477
.listview .listview-body .accordion-item:last-child .accordion-header {
9578
border-bottom: 1px solid var(--bb-lv-border-color);
9679
}

src/BootstrapBlazor/wwwroot/scss/theme/bootstrapblazor.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,9 @@ $bb-lv-border-color: var(--bs-border-color);
381381
$bb-lv-item-trans: border .3s linear;
382382
$bb-lv-item-border-hover-color: #409eff;
383383
$bb-lv-item-shadow: 0 2px 12px 0 rgba(0,0,0,.1);
384-
$bb-lv-body-padding: 1rem 0 0 1rem;
385-
$bb-lv-body-item-margin: 0 1rem 1rem 0;
386-
$bb-lv-footer-padding: 1rem;
384+
$bb-lv-body-padding: 0.5rem;
385+
$bb-lv-body-item-gap: 0.5rem;
386+
$bb-lv-footer-padding: 0.5rem;
387387

388388
// Logout
389389
$bb-logout-avatar-width: 42px;

0 commit comments

Comments
 (0)