Skip to content

Commit

Permalink
reivew
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Oct 16, 2019
1 parent 30095b5 commit 6bf3bc9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
39 changes: 21 additions & 18 deletions docs/src/pages/components/app-bar/app-bar.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,41 +39,44 @@ A side searchbar.

{{"demo": "pages/components/app-bar/BottomAppBar.js", "iframe": true, "maxWidth": 500}}

## Placement
## Fixed placement

When using Appbar `variant="fixed"` you need to have extra space for the content to show below
and not under. There are 2 ways to do it. Either use `theme.mixins.toolbar` like:
When you render the app bar position fixed, the dimension of the element doesn't impact the rest of the page. This can cause some part of your content to be invisible, behind the app bar. Here are 3 possible solutions:

```jsx
const useStyles = makeStyles(theme => ({
offset: theme.mixins.toolbar,
}))
1. You can use `position="sticky"` instead of fixed. ⚠️ sticky is not supported by IE 11.
2. You can render a second `<Toolbar />` component:

```jsx
function App() {
const classes = useStyles();
return (
<React.Fragment>
<Appbar position="fixed"></Appbar>
<div className={classes.offset}> {/* to accomdate for top white space */}
<AppBar position="fixed">
<Toolbar>{/* content */}</Toolbar>
</AppBar>
<Toolbar />
</React.Fragment>
)
};
);
}
```

Or you can append `<Toolbar />` component after `<Appbar />` like shown in the example
below. To prevent content from hiding under Appbar.
3. You can use `theme.mixins.toolbar` CSS:

```jsx
const useStyles = makeStyles(theme => ({
offset: theme.mixins.toolbar,
}))

function App() {
const classes = useStyles();
return (
<React.Fragment>
<AppBar position="fixed">
{/* AppBar content here */}
<Toolbar>{/* content */}</Toolbar>
</AppBar>
<Toolbar />
<div className={classes.offset} />
</React.Fragment>
);
}
)
};
```

## Scrolling
Expand Down
1 change: 1 addition & 0 deletions packages/material-ui/src/AppBar/AppBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const styles = theme => {
},
/* Styles applied to the root element if `position="sticky"`. */
positionSticky: {
// ⚠️ sticky is not supported by IE 11.
position: 'sticky',
top: 0,
left: 'auto',
Expand Down

0 comments on commit 6bf3bc9

Please sign in to comment.