Skip to content

Commit

Permalink
Add documentation for the styleguide.
Browse files Browse the repository at this point in the history
  • Loading branch information
leMaik committed Dec 16, 2017
1 parent ff783cb commit 2497498
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 3 deletions.
43 changes: 40 additions & 3 deletions src/FullscreenDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default function FullscreenDialog (props, { muiTheme }) {
style={{ ...styles.appBar, ...appBarStyle }}
iconElementLeft={(
<IconButton onClick={onRequestClose}>
{closeIcon || <NavigationCloseIcon />}
{closeIcon}
</IconButton>
)}
iconElementRight={actionButton}
Expand All @@ -73,23 +73,60 @@ export default function FullscreenDialog (props, { muiTheme }) {
}

FullscreenDialog.propTypes = {
/**
* A `FlatButton` or `IconButton` that is used as affirmative action button.
*/
actionButton: PropTypes.node,
/**
* Overrides the inline-styles of the app bar.
*/
appBarStyle: PropTypes.object,
/**
* Overrides the z-depth of the app bar, will affect its shadow. This is ignored if immersive is set to `true`.
*/
appBarZDepth: PropTypes.oneOf([0, 1, 2, 3, 4, 5]),
/**
* Children elements.
*/
children: PropTypes.node,
/**
* Icon element used for the dismissive action. This is hidden if `onRequestClose` is not set.
*/
closeIcon: PropTypes.node,
/**
* Overrides the inline-styles of the dialog's children container.
*/
containerStyle: PropTypes.object,
/**
* Toggles the immersive mode. If set to `true`, the app bar has a semi-transparent gradient and overlays the content.
*/
immersive: PropTypes.bool,
/**
* Callback that is invoked when the dismissive action button is touched.
*/
onRequestClose: PropTypes.func,
/**
* Controls whether the dialog is opened or not.
*/
open: PropTypes.bool.isRequired,
/**
* Overrides the inline-styles of the dialog's root element.
*/
style: PropTypes.object,
/**
* The title of the dialog.
*/
title: PropTypes.string,
/**
* Overrides the inline-styles of the app bar's title element.
*/
titleStyle: PropTypes.object
}

FullscreenDialog.defaultProps = {
immersive: false,
appBarZDepth: 1
appBarZDepth: 1,
closeIcon: <NavigationCloseIcon />,
immersive: false
}

FullscreenDialog.contextTypes = {
Expand Down
49 changes: 49 additions & 0 deletions src/FullscreenDialog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
This is a fullscreen dialog with a button on the right.

```
const RaisedButton = require('material-ui/RaisedButton').default;
const FlatButton = require('material-ui/FlatButton').default;
<div>
<FullscreenDialog
open={state.open}
onRequestClose={(...args) => {
setState({ open: false })
}}
title='Demo dialog'
actionButton={<FlatButton
label='Done'
onClick={() => setState({ open: false })}
/>}
/>
<RaisedButton
onClick={() => setState({ open: true })}
label='Open dialog'
/>
</div>
```

The fullscreen dialog also supports an _immersive mode_ that makes the app bar transparent.

```
const RaisedButton = require('material-ui/RaisedButton').default;
<div>
<FullscreenDialog
open={state.open}
onRequestClose={(...args) => {
setState({ open: false })
}}
title='Picture of a cat'
immersive
>
<div style={{ width: '100%', height: '100%', background: 'url(https://lorempixel.com/1920/1080/cats/)', backgroundSize: 'cover' }} />
</FullscreenDialog>
<RaisedButton
onClick={() => setState({ open: true })}
label='Show cat'
/>
</div>
```

0 comments on commit 2497498

Please sign in to comment.