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

Improve AppBar Customization #8681

Merged
merged 12 commits into from
Feb 27, 2023
Merged

Improve AppBar Customization #8681

merged 12 commits into from
Feb 27, 2023

Conversation

fzaninotto
Copy link
Member

@fzaninotto fzaninotto commented Feb 24, 2023

Problem

Adding new buttons or a search engine to the AppBar is cumbersome

Solution

  • Add a <TitlePortal> component to avoid copy/pasting a large <Typography> from the doc
  • Add a toolbar prop to let users override the default toolbar
  • Add an alwaysOn prop to facilitate always on toolbars (and deprecate component prop)
  • Fix styling glitches
  • Fix <Title> doesn't work without routing
  • Add Storybook
  • Add a dedicated AppBar doc chapter
  • Add a dedicated Title doc chapter
  • Fix <AppBar> usage examples in the doc and demos
  • Include screenshots in the doc
  • Final proofreading

Resulting API

To add buttons to the app bar, you can use the <AppBar> children prop.

For instance, to add <ToggleThemeButton>:

// in src/MyAppBar.js
import { 
    AppBar,
    TitlePortal,
    ToggleThemeButton,
    defaultTheme
} from 'react-admin';

const darkTheme = { palette: { mode: 'dark' } };

export const MyAppBar = () => (
    <AppBar>
        <TitlePortal />
        <ToggleThemeButton lightTheme={defaultTheme} darkTheme={darkTheme} />
    </AppBar>
);

@fzaninotto fzaninotto added the WIP Work In Progress label Feb 24, 2023
Copy link
Contributor

@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.

💪

docs/AppBar.md Outdated Show resolved Hide resolved
docs/AppBar.md Outdated Show resolved Hide resolved
docs/AppBar.md Outdated Show resolved Hide resolved
Co-authored-by: Gildas Garcia <1122076+djhi@users.noreply.github.com>
@fzaninotto fzaninotto added RFR Ready For Review and removed WIP Work In Progress labels Feb 26, 2023
@fzaninotto
Copy link
Member Author

Switching to RFR

@djhi djhi added this to the 4.8.2 milestone Feb 27, 2023
@djhi djhi modified the milestones: 4.8.2, 4.9.0 Feb 27, 2023
@djhi djhi merged commit 062a57c into next Feb 27, 2023
@djhi djhi deleted the appbar-improvements branch February 27, 2023 08:13
Comment on lines +174 to +175
* [<`Title>`](./Title.md)
* [<`TitlePortal>`](./AppBar.md#children)
Copy link

@cduran-seeri cduran-seeri Mar 24, 2023

Choose a reason for hiding this comment

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

Thanks! Found a typo, I'm not sure if this is an issue

<`Title>` to `<Title>`
<`TitlePortal>` to `<TitlePortal>`

Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch, can you open a PR to fix it?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure!

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.

None yet

4 participants