Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update data view layout #56786

Merged
merged 7 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/dataviews/src/dataviews.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ export default function DataViews( {
}, [ fields ] );
return (
<div className="dataviews-wrapper">
<VStack spacing={ 4 } justify="flex-start">
<HStack alignment="flex-start">
<VStack spacing={ 0 } justify="flex-start">
<HStack
alignment="flex-start"
className="dataviews__filters-view-actions"
>
<HStack justify="start" wrap>
{ search && (
<Search
Expand Down
41 changes: 34 additions & 7 deletions packages/dataviews/src/style.scss
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
.dataviews-wrapper {
width: 100%;
height: calc(100% - #{$grid-unit-40} * 2);
height: 100%;
overflow: auto;
padding: $grid-unit-40 $grid-unit-40 0;
Copy link
Contributor

@ntsekouras ntsekouras Dec 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're removing the padding here, probably we want to add some padding when we have no results and when showing the loading message. Besides the padding though, it would be good to improve them too - better messages or spinner/progress bar etc..

Screenshot 2023-12-07 at 10 17 13 AM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I fixed the padding for this (and the loading state) for now. Ideally both need a fresh design but that can come later.

box-sizing: border-box;

> div {
min-height: 100%;
}
}

.dataviews__filters-view-actions {
padding: $grid-unit-15 $grid-unit-40;
}

.dataviews-pagination {
margin-top: auto;
position: sticky;
bottom: 0;
background-color: $white;
padding: $grid-unit-20 0;
border-top: $border-width solid $gray-200;
padding: $grid-unit-15 $grid-unit-40;
border-top: $border-width solid $gray-100;
color: $gray-700;
}

.dataviews-filters-options {
Expand All @@ -29,9 +33,12 @@
border-color: inherit;
border-collapse: collapse;
position: relative;
color: $gray-700;

a {
text-decoration: none;
color: $gray-900;
font-weight: 500;
}
th {
text-align: left;
Expand All @@ -42,13 +49,24 @@
td,
th {
padding: $grid-unit-15;
min-width: 160px;
&[data-field-id="actions"] {
text-align: right;
}
}
tr {
border-bottom: 1px solid $gray-100;

td:first-child,
th:first-child {
padding-left: $grid-unit-40;
}

td:last-child,
th:last-child {
padding-right: $grid-unit-40;
}

&:last-child {
border-bottom: 0;
}
Expand All @@ -59,16 +77,20 @@
}
th {
position: sticky;
top: - #{$grid-unit-40}; // Offset the container padding
background-color: $white;
box-shadow: inset 0 -#{$border-width} 0 $gray-200;
top: -1px;
background-color: lighten($gray-100, 4%);
box-shadow: inset 0 -#{$border-width} 0 $gray-100;
border-top: 1px solid $gray-100;
padding-top: $grid-unit-05;
padding-bottom: $grid-unit-05;
}
}
}

.dataviews-grid-view {
margin-bottom: $grid-unit-30;
grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
padding: 0 $grid-unit-40;

@include break-xlarge() {
grid-template-columns: repeat(3, minmax(0, 1fr)) !important; // Todo: eliminate !important dependency
Expand Down Expand Up @@ -210,3 +232,8 @@
.dataviews-action-modal {
z-index: z-index(".dataviews-action-modal");
}

.dataviews-no-results,
.dataviews-loading {
padding: 0 $grid-unit-40;
}
13 changes: 11 additions & 2 deletions packages/dataviews/src/view-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ function HeaderMenu( { dataView, header } ) {
iconPosition="right"
text={ text }
style={ { padding: 0 } }
size="compact"
/>
}
>
Expand Down Expand Up @@ -543,7 +544,11 @@ function ViewTable( {
const hasRows = !! rows?.length;
if ( isLoading ) {
// TODO:Add spinner or progress bar..
return <h3>{ __( 'Loading' ) }</h3>;
return (
<div className="dataviews-loading">
<h3>{ __( 'Loading' ) }</h3>
</div>
);
}
return (
<div className="dataviews-table-view-wrapper">
Expand Down Expand Up @@ -607,7 +612,11 @@ function ViewTable( {
</tbody>
</table>
) }
{ ! hasRows && <p>{ __( 'no results' ) }</p> }
{ ! hasRows && (
<div className="dataviews-no-results">
<p>{ __( 'No results' ) }</p>
</div>
) }
</div>
);
}
Expand Down
4 changes: 3 additions & 1 deletion packages/edit-site/src/components/page-pages/style.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.edit-site-page-pages__featured-image {
border-radius: $radius-block-ui;
border-radius: $grid-unit-05;
width: $grid-unit-40;
height: $grid-unit-40;
}
3 changes: 2 additions & 1 deletion packages/edit-site/src/components/page/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export default function Header( { title, subTitle, actions } ) {
<FlexBlock className="edit-site-page-header__page-title">
<Heading
as="h2"
level={ 4 }
level={ 3 }
weight={ 500 }
className="edit-site-page-header__title"
>
{ title }
Expand Down
4 changes: 2 additions & 2 deletions packages/edit-site/src/components/page/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
}

.edit-site-page-header {
padding: 0 $grid-unit-40;
min-height: $header-height;
padding: $grid-unit-20 $grid-unit-40;
min-height: $grid-unit * 9;
border-bottom: 1px solid $gray-100;
background: $white;
position: sticky;
Expand Down
Loading