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

<mwc-top-app-bar> needs a way to pad content below #329

Closed
aomarks opened this issue Jul 31, 2019 · 1 comment · Fixed by #379
Closed

<mwc-top-app-bar> needs a way to pad content below #329

aomarks opened this issue Jul 31, 2019 · 1 comment · Fixed by #379
Assignees
Labels
Type: Feature New feature or request

Comments

@aomarks
Copy link
Collaborator

aomarks commented Jul 31, 2019

Content below a top-app-bar needs to be top-padded to account for the height of the fixed position bar, or else it will look like this, with the content hidden behind the bar:

bar.png

In standard MDC, users have direct access to classes like mdc-top-app-bar--short-fixed-adjust which specify the padding needed for a given bar configuration. MWC users do not have access to these classes, since they are in component shadow DOM.

We have a few options:

  1. Export a CSSResult from mwc-top-app-bar.js that provides these classes (or equivalents) that users can apply to their document or shadow root and then reference in their content. Something like:
.topAppBarPadding {
  padding-top: 64px; /* $mdc-top-app-bar-row-height */
}
@media (max-width: 599px) { /* $mdc-top-app-bar-mobile-breakpoint */
  .topAppBarPadding {
    padding-top: 56px; /* $mdc-top-app-bar-mobile-row-height */
  }
}
.topAppBarPaddingDense {
  padding-top: 48px; /* $mdc-top-app-bar-dense-row-height */
}
.topAppBarPaddingProminent {
  padding-top: 128px; /* $mdc-top-app-bar-prominent-row-height */
}
  1. Add a <slot> to <mwc-top-app-bar> to hold user content, and the element automatically applies the right style. This seems like the more user-friendly option, but it does mean that the element becomes more of a full-layout-wrapper, which seems not ideal. Maybe worth the tradeoff, though?
@aomarks aomarks added the Type: Bug Something isn't working label Jul 31, 2019
@aomarks aomarks added Component: Top App Bar Type: Feature New feature or request and removed Type: Bug Something isn't working labels Aug 14, 2019
@dfreedm dfreedm self-assigned this Aug 20, 2019
@aomarks
Copy link
Collaborator Author

aomarks commented Aug 27, 2019

For the record, #379 fixed this by adding a new default slot for user content, which will automatically have the correct padding-top applied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature New feature or request
Projects
None yet
2 participants