Skip to content

Commit

Permalink
Dataviews: Fix alignment issue of "Title" column header (WordPress#68840
Browse files Browse the repository at this point in the history
)

* fix: Alignment issue of first header in dataviews

* fix: Remove span parent of title field

* fix: Remove inline css and remove extra css code

Co-authored-by: im3dabasia <[email protected]>
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: hbhalodia <[email protected]>
Co-authored-by: ecgan <[email protected]>
  • Loading branch information
5 people authored Feb 23, 2025
1 parent 7afecbf commit c3151e8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 28 deletions.
42 changes: 16 additions & 26 deletions packages/dataviews/src/dataviews-layouts/table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,7 @@ function TableRow< Item >( {
} }
>
{ hasBulkActions && (
<td
className="dataviews-view-table__checkbox-column"
style={ {
width: '1%',
} }
>
<td className="dataviews-view-table__checkbox-column">
<div className="dataviews-view-table__cell-content-wrapper">
<DataViewsSelectionCheckbox
item={ item }
Expand Down Expand Up @@ -301,9 +296,6 @@ function ViewTable< Item >( {
{ hasBulkActions && (
<th
className="dataviews-view-table__checkbox-column"
style={ {
width: '1%',
} }
scope="col"
>
<BulkSelectionCheckbox
Expand All @@ -317,23 +309,21 @@ function ViewTable< Item >( {
) }
{ hasPrimaryColumn && (
<th scope="col">
<span className="dataviews-view-table-header">
{ titleField && (
<ColumnHeaderMenu
ref={ headerMenuRef(
titleField.id,
0
) }
fieldId={ titleField.id }
view={ view }
fields={ fields }
onChangeView={ onChangeView }
onHide={ onHide }
setOpenedFilter={ setOpenedFilter }
canMove={ false }
/>
) }
</span>
{ titleField && (
<ColumnHeaderMenu
ref={ headerMenuRef(
titleField.id,
0
) }
fieldId={ titleField.id }
view={ view }
fields={ fields }
onChangeView={ onChangeView }
onHide={ onHide }
setOpenedFilter={ setOpenedFilter }
canMove={ false }
/>
) }
</th>
) }
{ columns.map( ( column, index ) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/dataviews/src/dataviews-layouts/table/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

&.dataviews-view-table__checkbox-column {
padding-right: 0;
width: 1%;
}
}
tr {
Expand All @@ -37,8 +38,7 @@
th:first-child {
padding-left: $grid-unit-60;

.dataviews-view-table-header-button,
.dataviews-view-table-header {
.dataviews-view-table-header-button {
margin-left: - #{$grid-unit-10};
}
}
Expand Down

0 comments on commit c3151e8

Please sign in to comment.