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

Reduce top margin of <TopToolbar> to move content up when there is no filter #9232

Merged
merged 1 commit into from
Aug 30, 2023

Conversation

fzaninotto
Copy link
Member

@fzaninotto fzaninotto commented Aug 29, 2023

Problem

In List views, if there is no filter, some space is wasted between the app bar and the list. This is especially visible when using alternative layouts.

Capture d’écran 2023-08-29 à 21 38 23

Solution

Remove the min height of the TopToolbar(which applies to all pages) and add it to the FilterForm instead, so that the top toolbar remains tall enough when there are filters.

As a consequence:

  • list with filters see no change
  • list without filters have a reduced top margin

Before

marmelab com_react-admin-crm_ (4)

After

127 0 0 1_8000_

@fzaninotto fzaninotto added the RFR Ready For Review label Aug 29, 2023
@@ -63,18 +63,16 @@ export interface ListToolbarProps

const PREFIX = 'RaListToolbar';

const Root = styled(Toolbar, {
const Root = styled('div', {
Copy link
Member Author

Choose a reason for hiding this comment

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

The ListToolbar renders ListActions, which itself renders TopToolbar, which also renders a Toolbar. So there was a toolbar inside a toolbar, with added margin and padding... not really necessary.

@fzaninotto fzaninotto changed the title Reduce <TopToolbar> min height to move content up when there is no filter Reduce top margin of <TopToolbar> to move content up when there is no filter Aug 29, 2023
@fzaninotto fzaninotto added this to the 4.14.0 milestone Aug 29, 2023
Copy link
Collaborator

@djhi djhi left a comment

Choose a reason for hiding this comment

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

👍

@djhi djhi merged commit 7aba711 into next Aug 30, 2023
8 checks passed
@djhi djhi deleted the top-toolbar-margin branch August 30, 2023 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants