element-web-Github/res/css/views/rooms/_IRCLayout.pcss
Suguru Hirahara ba796504f5
Tidy up IRCLayout.pcss (#10189)
* Specify the data-layout=irc against ':not([data-layout=bubble])'

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

* Include mx_EventTile_info in mx_EventTile[data-layout=irc]

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

* Move declarations up, removing a default declaration

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

* Tidy up mx_EventTile:hover

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

* Use a spacing variable

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

* Sort by order properties

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

* Move and add comments

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

* Merge style declarations - flex-shrink and height

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

* Consider cascading order

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

* Move order declaration top

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

* Fix an invalid comment

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

---------

Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>
2023-04-23 07:37:20 +00:00

234 lines
6.8 KiB
Plaintext

/*
Copyright 2020 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.
*/
$irc-line-height: $font-18px;
.mx_IRCLayout {
--name-width: 80px; /* cf. ircDisplayNameWidth on Settings.tsx */
--icon-width: 14px;
--line-height: $irc-line-height;
--right-padding: 5px; /* TODO: Use a spacing variable */
line-height: var(--line-height) !important;
blockquote {
margin: 0;
}
.mx_NewRoomIntro {
> h2 {
line-height: initial; /* Cancel $irc-line-height */
}
}
.mx_EventTile[data-layout="irc"] {
--EventTile_irc_line-padding-block: 1px;
display: flex;
align-items: flex-start;
padding-top: 0;
> a {
text-decoration: none; /* timestamps are links which shouldn't be underlined */
min-width: $MessageTimestamp_width; /* ensure space for EventTile without timestamp */
}
> * {
margin-right: var(--right-padding);
}
.mx_EventTile_avatar,
.mx_EventTile_e2eIcon {
height: $irc-line-height;
}
.mx_EventTile_avatar,
.mx_DisambiguatedProfile,
.mx_EventTile_e2eIcon,
.mx_EventTile_msgOption {
flex-shrink: 0;
}
.mx_EventTile_avatar {
order: 1;
position: relative;
display: flex;
align-items: center;
/* Need to use important to override the js provided height and width values. */
> .mx_BaseAvatar,
> .mx_BaseAvatar > * {
height: $font-14px !important;
width: $font-14px !important;
font-size: $font-10px !important;
line-height: $font-15px !important;
}
}
.mx_DisambiguatedProfile {
order: 2;
width: var(--name-width);
margin-inline-end: 0; /* override mx_EventTile > * */
> .mx_DisambiguatedProfile_displayName {
width: 100%;
text-align: end;
overflow: hidden;
text-overflow: ellipsis;
}
> .mx_DisambiguatedProfile_mxid {
visibility: collapse;
margin-left: 0; /* Override the inherited margin. */
padding: 0 5px; /* TODO: Use a spacing variable */
}
&:hover {
overflow: visible;
z-index: 10;
> .mx_DisambiguatedProfile_displayName {
overflow: visible;
display: inline;
background-color: $event-selected-color;
border-radius: 8px 0 0 8px;
padding-right: $spacing-8;
}
> .mx_DisambiguatedProfile_mxid {
visibility: visible;
opacity: 1;
background-color: $event-selected-color;
}
}
}
.mx_EventTile_e2eIcon {
padding: 0;
flex-grow: 0;
background-position: center;
}
.mx_EventTile_line {
.mx_EventTile_e2eIcon,
.mx_TextualEvent,
.mx_ViewSourceEvent,
.mx_MTextBody {
/* add a 1px padding top and bottom because our larger
emoji font otherwise gets cropped by anti-zalgo */
padding: var(--EventTile_irc_line-padding-block) 0;
}
.mx_EventTile_e2eIcon,
.mx_TextualEvent,
.mx_MTextBody {
display: inline-block;
}
.mx_ReplyTile {
.mx_MTextBody {
display: -webkit-box; /* Enable -webkit-line-clamp */
}
}
}
.mx_EventTile_line,
.mx_EventTile_reply {
order: 3;
display: flex;
flex-direction: column;
flex-grow: 1;
flex-shrink: 1;
min-width: 0;
}
.mx_EventTile_reply {
order: 4;
}
.mx_EventTile_msgOption {
order: 5;
}
.mx_EditMessageComposer_buttons {
position: relative;
}
&.mx_EventTile_info {
.mx_ViewSourceEvent, /* For hidden events */
.mx_TextualEvent {
line-height: $irc-line-height;
}
}
}
.mx_EventTile_emote {
.mx_EventTile_avatar {
/* add --right-padding value of MessageTimestamp only */
margin-left: calc(var(--name-width) + var(--icon-width) + 1 * var(--right-padding));
}
}
.mx_ReplyChain {
.mx_DisambiguatedProfile {
width: unset;
background: transparent;
order: unset;
flex-shrink: unset; /* Unset flex-shrink to prevent long display name blowout */
}
.mx_EventTile_emote {
> .mx_EventTile_avatar {
margin-left: initial;
}
}
.mx_MessageTimestamp {
width: initial;
}
/**
* adding the icon back in the document flow
* if it's not present, there's no unwanted wasted space
*/
.mx_EventTile_e2eIcon {
position: relative;
order: -1;
}
}
.mx_ProfileResizer {
--resizer-width: 15px;
--resizer-a11y: 3px; /* Magic number, to be replaced with something more proper from the perspective of a11y */
position: absolute;
height: 100%;
width: var(--resizer-width);
cursor: col-resize;
z-index: 100;
/* Add width of every element rendered before the resizer (including padding for the avatar and the display
name), subtracting the resizer width itself to prevent the resizer from overlapping the text and moving
the resizer a bit to the left to make it easier to avoid selecting the resizer when highlighting text.
Please note that MessageTimestamp does not have inline padding. */
inset-inline-start: calc(
var(--RoomView_MessageList-padding) + var(--MessageTimestamp-width) + var(--icon-width) +
var(--right-padding) + var(--name-width) + var(--right-padding) - var(--resizer-width) -
var(--resizer-a11y)
);
}
}