question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[AppBar] Add AppBarContainer component providing padding and layout automatically

See original GitHub issue

Let me know if this has been previously debated, I’d love to read the discussion!

Today I think creating a simple layout with an AppBar at the top of the page is unnecessarily complex, as developers need to manually set the AppBar to fixed position and add padding to whatever is under it with the same height as it will be (which turns out to be spacing.desktopKeylineIncrement).

Has it been discussed previously whether we should instead architect more around a composition model, so for example we could have an <AppBarContainer> (name subject to bikeshedding) component with which you would write:

<AppBarContainer>
  <ThePageContents />
</AppBarContainer>

as shorthand for

<AppBar style={{ position: fixed; top: 0 }} />
<ThePageContents style={{ paddingTop: spacing.desktopKeylineIncrement }} />

I feel like that would make things way easier for developers and would allow for higher-level effects to be implemented like hiding-on-scroll etc.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
newogacommented, Apr 16, 2016

@owencm Here is a proof of concept that needs some cleaning up but is what we had in mind for next iteration of AppBar.

http://newoga.github.io/material-ui-scrolling-techniques/ https://github.com/newoga/material-ui-scrolling-techniques

The children of AppBar was going to be used to compose different parts of the AppBar rather than page content. That being said, it still automatically manages padding the dynamic size of the AppBar for you so that you can just provide your <PageContents /> beneath it without having to worry about positioning.

1reaction
newogacommented, May 27, 2016

@devdlabs In my projects I use my own <AppBar /> implementation when the existing ones do not suffice. It’s a lot simpler and uses standard flex layout to organize the parts of the AppBar. If the only thing you care about is the Toolbar portion of the <AppBar />, then you also may have better luck using material-ui’s <Toolbar /> component.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[AppBar] Add AppBarContainer component providing padding ...
Today I think creating a simple layout with an AppBar at the top of the page is unnecessarily complex, as developers need to...
Read more >
Material-UI app bar comes with a margin - Stack Overflow
Just insert CssBaseline tag before any element whose default margins you want to remove. Like import React, { Component } from 'react'; import...
Read more >
AppBar class - material library - Flutter - Dart API docs
The AppBar insets its content based on the ambient MediaQuery's padding, to avoid system UI intrusions. It's taken care of by Scaffold when...
Read more >
Add the app bar - Android Developers
Add the app bar · A dedicated space for giving your app an identity and indicating the user's location in the app. ·...
Read more >
Flutter Widgets Flashcards - Quizlet
A widget that specializes in padding, margins, borders, fills, and sizing. ... The size isn't actually flexible unless the AppBar's container changes the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found