forked from treehouse/mastodon
[Glitch] Compensate for scrollbar disappearing when media modal
Port 60df87f6f0
to glitch-soc
signup-info-prompt
parent
d2b3eebe00
commit
175c2155a9
|
@ -29,19 +29,19 @@ export default class MediaContainer extends PureComponent {
|
||||||
};
|
};
|
||||||
|
|
||||||
handleOpenMedia = (media, index) => {
|
handleOpenMedia = (media, index) => {
|
||||||
document.body.classList.add('media-standalone__body');
|
document.body.classList.add('with-modals--active');
|
||||||
this.setState({ media, index });
|
this.setState({ media, index });
|
||||||
}
|
}
|
||||||
|
|
||||||
handleOpenVideo = (video, time) => {
|
handleOpenVideo = (video, time) => {
|
||||||
const media = ImmutableList([video]);
|
const media = ImmutableList([video]);
|
||||||
|
|
||||||
document.body.classList.add('media-standalone__body');
|
document.body.classList.add('with-modals--active');
|
||||||
this.setState({ media, time });
|
this.setState({ media, time });
|
||||||
}
|
}
|
||||||
|
|
||||||
handleCloseMedia = () => {
|
handleCloseMedia = () => {
|
||||||
document.body.classList.remove('media-standalone__body');
|
document.body.classList.remove('with-modals--active');
|
||||||
this.setState({ media: null, index: null, time: null });
|
this.setState({ media: null, index: null, time: null });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,14 +45,15 @@ export default class ModalRoot extends React.PureComponent {
|
||||||
};
|
};
|
||||||
|
|
||||||
getSnapshotBeforeUpdate () {
|
getSnapshotBeforeUpdate () {
|
||||||
const visible = !!this.props.type;
|
return { visible: !!this.props.type };
|
||||||
return {
|
|
||||||
overflowY: visible ? 'hidden' : null,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate (prevProps, prevState, { overflowY }) {
|
componentDidUpdate (prevProps, prevState, { visible }) {
|
||||||
document.body.style.overflowY = overflowY;
|
if (visible) {
|
||||||
|
document.body.classList.add('with-modals--active');
|
||||||
|
} else {
|
||||||
|
document.body.classList.remove('with-modals--active');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renderLoading = modalId => () => {
|
renderLoading = modalId => () => {
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
body {
|
body {
|
||||||
font-family: 'mastodon-font-sans-serif', sans-serif;
|
font-family: 'mastodon-font-sans-serif', sans-serif;
|
||||||
background: darken($ui-base-color, 8%);
|
background: darken($ui-base-color, 8%);
|
||||||
background-size: cover;
|
|
||||||
background-attachment: fixed;
|
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
line-height: 18px;
|
line-height: 18px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
|
@ -34,16 +32,24 @@ body {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
background: $ui-base-color;
|
background: $ui-base-color;
|
||||||
|
|
||||||
|
&.with-modals--active {
|
||||||
|
overflow-y: hidden;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.about-body {
|
&.lighter {
|
||||||
background: darken($ui-base-color, 8%);
|
background: $ui-base-color;
|
||||||
padding-bottom: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&.tag-body {
|
&.with-modals {
|
||||||
background: darken($ui-base-color, 8%);
|
overflow-x: hidden;
|
||||||
padding-bottom: 0;
|
overflow-y: scroll;
|
||||||
|
|
||||||
|
&--active {
|
||||||
|
overflow-y: hidden;
|
||||||
|
margin-right: 13px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.embed {
|
&.embed {
|
||||||
|
|
|
@ -60,10 +60,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.media-standalone__body {
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.account-header {
|
.account-header {
|
||||||
width: 400px;
|
width: 400px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
|
Loading…
Reference in New Issue