element-web-Github/res/css/views/messages/_MImageBody.scss
Suguru Hirahara 5446d5d6ba
Fix position of wide images on IRC / modern layout (#8667)
* Move declarations related to position from _MImageBody.scss to _EventTile.scss

These declarations should not be defined as default values as position depends on other factors such as layout, etc.

Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>

* Move min-height and min-width declarations from _MImageBody.scss to _EventTile.scss

Since min-height and min-width have been specified for bubble layout, the declarations have been expected to be applied to the other layouts.

Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>

* Apply 'justify-content: center' to bubble layout only

'justify-content: center' was added for the bubble layout with 1436f23. It should not be applied to the other layouts.

In order to prevent an issue related to cascading from happening, 'justify-content: flex-start' is explicitly specified.

Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>

* yarn run lint:style --fix

Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
2022-05-23 09:02:13 +02:00

142 lines
3.9 KiB
SCSS

/*
Copyright 2015, 2016 OpenMarket Ltd
Copyright 2021 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
$timeline-image-border-radius: 8px;
.mx_MImageBody_banner {
position: absolute;
bottom: 4px;
left: 4px;
padding: 4px;
border-radius: $timeline-image-border-radius;
font-size: $font-15px;
pointer-events: none; // let the cursor go through to the media underneath
// Trying to match the width of the image is surprisingly difficult, so arbitrarily break it off early.
max-width: min(100%, 350px);
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
// Hardcoded colours because it's the same on all themes
background-color: rgba(0, 0, 0, 0.6);
color: #ffffff;
}
.mx_MImageBody_placeholder {
// Position the placeholder on top of the thumbnail, so that the reveal animation can work
position: absolute;
left: 0;
top: 0;
height: 100%;
width: 100%;
background-color: $background;
.mx_Blurhash > canvas {
animation: mx--anim-pulse 1.75s infinite cubic-bezier(.4, 0, .6, 1);
}
}
.mx_MImageBody {
.mx_MImageBody_thumbnail_container {
border-radius: $timeline-image-border-radius;
// Necessary for the border radius to apply correctly to the placeholder
overflow: hidden;
contain: paint;
// Override inline max-width value to avoid overflow
max-width: 100% !important;
.mx_MImageBody_thumbnail {
// Apply the border radius to an image directly.
// This is necessary for images smaller than the placeholder.
border-radius: $timeline-image-border-radius;
}
}
}
.mx_MImageBody_thumbnail {
display: block;
// Force the image to be the full size of the container, even if the
// pixel size is smaller. The problem here is that we don't know what
// thumbnail size the HS is going to give us, but we have to commit to
// a container size immediately and not change it when the image loads
// or we'll get a scroll jump (or have to leave blank space).
// This will obviously result in an upscaled image which will be a bit
// blurry. The best fix would be for the HS to advertise what size thumbnails
// it guarantees to produce.
height: 100%;
width: 100%;
}
.mx_MImageBody_gifLabel {
position: absolute;
display: block;
top: 0px;
left: 14px;
padding: 5px;
border-radius: 5px;
background: $imagebody-giflabel;
border: 2px solid $imagebody-giflabel-border;
color: $imagebody-giflabel-color;
pointer-events: none;
}
.mx_HiddenImagePlaceholder {
position: absolute;
left: 0;
top: 0;
bottom: 0;
right: 0;
// To center the text in the middle of the frame
display: flex;
align-items: center;
justify-content: center;
text-align: center;
cursor: pointer;
background-color: $header-panel-bg-color;
.mx_HiddenImagePlaceholder_button {
color: $accent;
span.mx_HiddenImagePlaceholder_eye {
margin-right: 8px;
background-color: $accent;
mask-image: url('$(res)/img/feather-customised/eye.svg');
display: inline-block;
width: 18px;
height: 14px;
}
span:not(.mx_HiddenImagePlaceholder_eye) {
vertical-align: text-bottom;
}
}
}
.mx_EventTile:hover .mx_HiddenImagePlaceholder {
background-color: $background;
}