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

Max width #17

Merged
merged 8 commits into from
Mar 18, 2019
Merged
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
28 changes: 28 additions & 0 deletions paper-bottom-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,22 @@ class PaperBottomSheet extends mixinBehaviors([IronSelectableBehavior], PolymerE
value: 'Cancel',
},

/**
* CSS value for margin of the sheet. Leave this empty to use full-width
*/
margin: {
observer: '_marginChanged',
type: String
},

/**
* CSS value for max-width of the sheet. Leave this empty to use full-width
*/
maxWidth: {
observer: '_maxWidthChanged',
type: String
},

/**
* True if the bottom sheet acts like a modal dialog (e.g. can't be closed by clicking outside).
* Note that the "cancel" option will disappear if the dialog is not modal, as the "cancel" option
Expand Down Expand Up @@ -206,6 +222,18 @@ class PaperBottomSheet extends mixinBehaviors([IronSelectableBehavior], PolymerE
}
}

_maxWidthChanged(newValue) {
this.$.dialog.style.maxWidth = newValue;
}

_marginChanged(newValue) {
if (newValue && newValue.length) {
this.$.dialog.style.setProperty('margin', newValue, 'important');
} else {
this.$.dialog.style.margin = '';
}
}

_onNeonAnimationFinish() {
if (this._placeHolder) {
const height = Array.from(this.$.dialog.children).reduce((total, x) => total + x.offsetHeight, 0);
Expand Down