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

[AppBar] Add position="relative" #12790

Merged
merged 3 commits into from
Sep 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/material-ui/src/AppBar/AppBar.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { PaperProps } from '../Paper';

export interface AppBarProps extends StandardProps<PaperProps, AppBarClassKey> {
color?: PropTypes.Color;
position?: 'fixed' | 'absolute' | 'sticky' | 'static';
position?: 'fixed' | 'absolute' | 'sticky' | 'static' | 'relative';
}

export type AppBarClassKey =
Expand All @@ -12,6 +12,7 @@ export type AppBarClassKey =
| 'positionAbsolute'
| 'positionSticky'
| 'positionStatic'
| 'positionRelative'
| 'colorDefault'
| 'colorPrimary'
| 'colorSecondary';
Expand Down
6 changes: 5 additions & 1 deletion packages/material-ui/src/AppBar/AppBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ export const styles = theme => {
positionStatic: {
position: 'static',
},
/* Styles applied to the root element if `position="relative"`. */
positionRelative: {
position: 'relative',
},
/* Styles applied to the root element if `color="default"`. */
colorDefault: {
backgroundColor: backgroundColorDefault,
Expand Down Expand Up @@ -107,7 +111,7 @@ AppBar.propTypes = {
* [here](https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Positioning).
* Note: `sticky` is not universally supported and will fall back to `static` when unavailable.
*/
position: PropTypes.oneOf(['fixed', 'absolute', 'sticky', 'static']),
position: PropTypes.oneOf(['fixed', 'absolute', 'sticky', 'static', 'relative']),
};

AppBar.defaultProps = {
Expand Down
3 changes: 2 additions & 1 deletion pages/api/app-bar.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import AppBar from '@material-ui/core/AppBar';
| <span class="prop-name required">children *</span> | <span class="prop-type">node |   | The content of the component. |
| <span class="prop-name">classes</span> | <span class="prop-type">object |   | Override or extend the styles applied to the component. See [CSS API](#css-api) below for more details. |
| <span class="prop-name">color</span> | <span class="prop-type">enum:&nbsp;'inherit'&nbsp;&#124;<br>&nbsp;'primary'&nbsp;&#124;<br>&nbsp;'secondary'&nbsp;&#124;<br>&nbsp;'default'<br> | <span class="prop-default">'primary'</span> | The color of the component. It supports those theme colors that make sense for this component. |
| <span class="prop-name">position</span> | <span class="prop-type">enum:&nbsp;'fixed'&nbsp;&#124;<br>&nbsp;'absolute'&nbsp;&#124;<br>&nbsp;'sticky'&nbsp;&#124;<br>&nbsp;'static'<br> | <span class="prop-default">'fixed'</span> | The positioning type. The behavior of the different options is described [here](https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Positioning). Note: `sticky` is not universally supported and will fall back to `static` when unavailable. |
| <span class="prop-name">position</span> | <span class="prop-type">enum:&nbsp;'fixed', 'absolute', 'sticky', 'static', 'relative'<br> | <span class="prop-default">'fixed'</span> | The positioning type. The behavior of the different options is described [here](https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Positioning). Note: `sticky` is not universally supported and will fall back to `static` when unavailable. |

Any other properties supplied will be spread to the root element ([Paper](/api/paper)).

Expand All @@ -39,6 +39,7 @@ This property accepts the following keys:
| <span class="prop-name">positionAbsolute</span> | Styles applied to the root element if `position="absolute"`.
| <span class="prop-name">positionSticky</span> | Styles applied to the root element if `position="sticky"`.
| <span class="prop-name">positionStatic</span> | Styles applied to the root element if `position="static"`.
| <span class="prop-name">positionRelative</span> | Styles applied to the root element if `position="relative"`.
| <span class="prop-name">colorDefault</span> | Styles applied to the root element if `color="default"`.
| <span class="prop-name">colorPrimary</span> | Styles applied to the root element if `color="primary"`.
| <span class="prop-name">colorSecondary</span> | Styles applied to the root element if `color="secondary"`.
Expand Down