diff --git a/res/css/_components.scss b/res/css/_components.scss index 6659e2a746..e856fa8589 100644 --- a/res/css/_components.scss +++ b/res/css/_components.scss @@ -180,7 +180,7 @@ @import "./views/rooms/_RoomList.scss"; @import "./views/rooms/_RoomPreviewBar.scss"; @import "./views/rooms/_RoomRecoveryReminder.scss"; -@import "./views/rooms/_RoomSublist2.scss"; +@import "./views/rooms/_RoomSublist.scss"; @import "./views/rooms/_RoomTile.scss"; @import "./views/rooms/_RoomTileIcon.scss"; @import "./views/rooms/_RoomUpgradeWarningBar.scss"; diff --git a/res/css/views/rooms/_RoomSublist2.scss b/res/css/views/rooms/_RoomSublist.scss similarity index 82% rename from res/css/views/rooms/_RoomSublist2.scss rename to res/css/views/rooms/_RoomSublist.scss index eac2aa838d..1fc746df5b 100644 --- a/res/css/views/rooms/_RoomSublist2.scss +++ b/res/css/views/rooms/_RoomSublist.scss @@ -16,7 +16,7 @@ limitations under the License. // TODO: Rename on launch: https://github.com/vector-im/riot-web/issues/14367 -.mx_RoomSublist2 { +.mx_RoomSublist { // The sublist is a column of rows, essentially display: flex; flex-direction: column; @@ -27,7 +27,7 @@ limitations under the License. flex-shrink: 0; // to convince safari's layout engine the flexbox is fine - .mx_RoomSublist2_headerContainer { + .mx_RoomSublist_headerContainer { // Create a flexbox to make alignment easy display: flex; align-items: center; @@ -49,7 +49,7 @@ limitations under the License. height: 24px; color: $roomlist2-header-color; - .mx_RoomSublist2_stickable { + .mx_RoomSublist_stickable { flex: 1; max-width: 100%; @@ -61,26 +61,26 @@ limitations under the License. // to identify when a header is sticky. If we didn't have a consistent sticky class, // we'd have to do the "is sticky" checks again on click, as clicking the header // when sticky scrolls instead of collapses the list. - &.mx_RoomSublist2_headerContainer_sticky { + &.mx_RoomSublist_headerContainer_sticky { position: fixed; height: 32px; // to match the header container // width set by JS width: calc(100% - 22px); } - &.mx_RoomSublist2_headerContainer_stickyBottom { + &.mx_RoomSublist_headerContainer_stickyBottom { bottom: 0; } // We don't have a top style because the top is dependent on the room list header's // height, and is therefore calculated in JS. - // The class, mx_RoomSublist2_headerContainer_stickyTop, is applied though. + // The class, mx_RoomSublist_headerContainer_stickyTop, is applied though. } // Sticky Headers End // *************************** - .mx_RoomSublist2_badgeContainer { + .mx_RoomSublist_badgeContainer { // Create another flexbox row because it's super easy to position the badge this way. display: flex; align-items: center; @@ -93,14 +93,14 @@ limitations under the License. } } - &:not(.mx_RoomSublist2_headerContainer_withAux) { + &:not(.mx_RoomSublist_headerContainer_withAux) { .mx_NotificationBadge { margin-right: 4px; // just to push it over a bit, aligning it with the other elements } } - .mx_RoomSublist2_auxButton, - .mx_RoomSublist2_menuButton { + .mx_RoomSublist_auxButton, + .mx_RoomSublist_menuButton { margin-left: 8px; // should be the same as the notification badge position: relative; width: 24px; @@ -122,21 +122,21 @@ limitations under the License. } // Hide the menu button by default - .mx_RoomSublist2_menuButton { + .mx_RoomSublist_menuButton { visibility: hidden; width: 0; margin: 0; } - .mx_RoomSublist2_auxButton::before { + .mx_RoomSublist_auxButton::before { mask-image: url('$(res)/img/feather-customised/plus.svg'); } - .mx_RoomSublist2_menuButton::before { + .mx_RoomSublist_menuButton::before { mask-image: url('$(res)/img/element-icons/context-menu.svg'); } - .mx_RoomSublist2_headerText { + .mx_RoomSublist_headerText { flex: 1; max-width: calc(100% - 16px); // 16px is the badge width line-height: $font-16px; @@ -148,7 +148,7 @@ limitations under the License. overflow: hidden; white-space: nowrap; - .mx_RoomSublist2_collapseBtn { + .mx_RoomSublist_collapseBtn { display: inline-block; position: relative; width: 12px; @@ -169,7 +169,7 @@ limitations under the License. mask-image: url('$(res)/img/feather-customised/chevron-down.svg'); } - &.mx_RoomSublist2_collapseBtn_collapsed::before { + &.mx_RoomSublist_collapseBtn_collapsed::before { mask-image: url('$(res)/img/feather-customised/chevron-right.svg'); } } @@ -181,12 +181,12 @@ limitations under the License. // when scrolled to the top above the first sublist (whose header can only // ever stick to top), so we force height to 0 for only that first header. // See also https://github.com/vector-im/riot-web/issues/14429. - &:first-child .mx_RoomSublist2_headerContainer { + &:first-child .mx_RoomSublist_headerContainer { height: 0; padding-bottom: 4px; } - .mx_RoomSublist2_resizeBox { + .mx_RoomSublist_resizeBox { position: relative; // Create another flexbox column for the tiles @@ -194,7 +194,7 @@ limitations under the License. flex-direction: column; overflow: hidden; - .mx_RoomSublist2_tiles { + .mx_RoomSublist_tiles { flex: 1 0 0; overflow: hidden; // need this to be flex otherwise the overflow hidden from above @@ -206,18 +206,18 @@ limitations under the License. mask-image: linear-gradient(0deg, transparent, black 4px); } - .mx_RoomSublist2_resizerHandles_showNButton { + .mx_RoomSublist_resizerHandles_showNButton { flex: 0 0 32px; } - .mx_RoomSublist2_resizerHandles { + .mx_RoomSublist_resizerHandles { flex: 0 0 4px; } // Class name comes from the ResizableBox component // The hover state needs to use the whole sublist, not just the resizable box, // so that selector is below and one level higher. - .mx_RoomSublist2_resizerHandle { + .mx_RoomSublist_resizerHandle { cursor: ns-resize; border-radius: 3px; @@ -235,21 +235,21 @@ limitations under the License. right: calc(50% - 32px) !important; } - &:hover, &.mx_RoomSublist2_hasMenuOpen { - .mx_RoomSublist2_resizerHandle { + &:hover, &.mx_RoomSublist_hasMenuOpen { + .mx_RoomSublist_resizerHandle { opacity: 0.8; background-color: $primary-fg-color; } } } - .mx_RoomSublist2_showNButton { + .mx_RoomSublist_showNButton { cursor: pointer; font-size: $font-13px; line-height: $font-18px; color: $roomtile2-preview-color; - // Update the render() function for RoomSublist2 if these change + // Update the render() function for RoomSublist if these change // Update the ListLayout class for minVisibleTiles if these change. height: 24px; padding-bottom: 4px; @@ -258,7 +258,7 @@ limitations under the License. display: flex; align-items: center; - .mx_RoomSublist2_showNButtonChevron { + .mx_RoomSublist_showNButtonChevron { position: relative; width: 16px; height: 16px; @@ -270,43 +270,43 @@ limitations under the License. background: $roomtile2-preview-color; } - .mx_RoomSublist2_showMoreButtonChevron { + .mx_RoomSublist_showMoreButtonChevron { mask-image: url('$(res)/img/feather-customised/chevron-down.svg'); } - .mx_RoomSublist2_showLessButtonChevron { + .mx_RoomSublist_showLessButtonChevron { mask-image: url('$(res)/img/feather-customised/chevron-up.svg'); } } - &.mx_RoomSublist2_hasMenuOpen, - &:not(.mx_RoomSublist2_minimized) > .mx_RoomSublist2_headerContainer:focus-within, - &:not(.mx_RoomSublist2_minimized) > .mx_RoomSublist2_headerContainer:hover { - .mx_RoomSublist2_menuButton { + &.mx_RoomSublist_hasMenuOpen, + &:not(.mx_RoomSublist_minimized) > .mx_RoomSublist_headerContainer:focus-within, + &:not(.mx_RoomSublist_minimized) > .mx_RoomSublist_headerContainer:hover { + .mx_RoomSublist_menuButton { visibility: visible; width: 24px; margin-left: 8px; } } - &.mx_RoomSublist2_minimized { - .mx_RoomSublist2_headerContainer { + &.mx_RoomSublist_minimized { + .mx_RoomSublist_headerContainer { height: auto; flex-direction: column; position: relative; - .mx_RoomSublist2_badgeContainer { + .mx_RoomSublist_badgeContainer { order: 0; align-self: flex-end; margin-right: 0; } - .mx_RoomSublist2_stickable { + .mx_RoomSublist_stickable { order: 1; max-width: 100%; } - .mx_RoomSublist2_auxButton { + .mx_RoomSublist_auxButton { order: 2; visibility: visible; width: 32px !important; // !important to override hover styles @@ -322,25 +322,25 @@ limitations under the License. } } - .mx_RoomSublist2_resizeBox { + .mx_RoomSublist_resizeBox { align-items: center; } - .mx_RoomSublist2_showNButton { + .mx_RoomSublist_showNButton { flex-direction: column; - .mx_RoomSublist2_showNButtonChevron { + .mx_RoomSublist_showNButtonChevron { margin-right: 12px; // to center } } - .mx_RoomSublist2_menuButton { + .mx_RoomSublist_menuButton { height: 16px; } - &.mx_RoomSublist2_hasMenuOpen, - & > .mx_RoomSublist2_headerContainer:hover { - .mx_RoomSublist2_menuButton { + &.mx_RoomSublist_hasMenuOpen, + & > .mx_RoomSublist_headerContainer:hover { + .mx_RoomSublist_menuButton { visibility: visible; position: absolute; bottom: 48px; // align to middle of name, 40px for aux button (with padding) and 8px for alignment @@ -360,8 +360,8 @@ limitations under the License. } } - &.mx_RoomSublist2_headerContainer:not(.mx_RoomSublist2_headerContainer_withAux) { - .mx_RoomSublist2_menuButton { + &.mx_RoomSublist_headerContainer:not(.mx_RoomSublist_headerContainer_withAux) { + .mx_RoomSublist_menuButton { bottom: 8px; // align to the middle of name, 40px less than the `bottom` above. } } @@ -369,7 +369,7 @@ limitations under the License. } } -.mx_RoomSublist2_contextMenu { +.mx_RoomSublist_contextMenu { padding: 20px 16px; width: 250px; @@ -381,7 +381,7 @@ limitations under the License. opacity: 0.1; } - .mx_RoomSublist2_contextMenu_title { + .mx_RoomSublist_contextMenu_title { font-size: $font-15px; line-height: $font-20px; font-weight: 600; @@ -393,6 +393,6 @@ limitations under the License. } } -.mx_RoomSublist2_addRoomTooltip { +.mx_RoomSublist_addRoomTooltip { margin-top: -3px; } diff --git a/res/themes/light/css/_mods.scss b/res/themes/light/css/_mods.scss index 54ba7795ee..9a59acba8e 100644 --- a/res/themes/light/css/_mods.scss +++ b/res/themes/light/css/_mods.scss @@ -21,7 +21,7 @@ } } -.mx_RoomSublist2_showNButton { +.mx_RoomSublist_showNButton { background-color: transparent !important; } diff --git a/src/components/structures/LeftPanel.tsx b/src/components/structures/LeftPanel.tsx index f1b22d99a5..3fedd9adb5 100644 --- a/src/components/structures/LeftPanel.tsx +++ b/src/components/structures/LeftPanel.tsx @@ -21,7 +21,7 @@ import classNames from "classnames"; import dis from "../../dispatcher/dispatcher"; import { _t } from "../../languageHandler"; import RoomList from "../views/rooms/RoomList"; -import { HEADER_HEIGHT } from "../views/rooms/RoomSublist2"; +import { HEADER_HEIGHT } from "../views/rooms/RoomSublist"; import { Action } from "../../dispatcher/actions"; import UserMenu from "./UserMenu"; import RoomSearch from "./RoomSearch"; @@ -50,9 +50,9 @@ interface IState { const cssClasses = [ "mx_RoomSearch_input", "mx_RoomSearch_icon", // minimized - "mx_RoomSublist2_headerText", + "mx_RoomSublist_headerText", "mx_RoomTile", - "mx_RoomSublist2_showNButton", + "mx_RoomSublist_showNButton", ]; export default class LeftPanel extends React.Component { @@ -119,7 +119,7 @@ export default class LeftPanel extends React.Component { private doStickyHeaders(list: HTMLDivElement) { const topEdge = list.scrollTop; const bottomEdge = list.offsetHeight + list.scrollTop; - const sublists = list.querySelectorAll(".mx_RoomSublist2"); + const sublists = list.querySelectorAll(".mx_RoomSublist"); const headerRightMargin = 16; // calculated from margins and widths to align with non-sticky tiles const headerStickyWidth = list.clientWidth - headerRightMargin; @@ -135,7 +135,7 @@ export default class LeftPanel extends React.Component { let lastTopHeader; let firstBottomHeader; for (const sublist of sublists) { - const header = sublist.querySelector(".mx_RoomSublist2_stickable"); + const header = sublist.querySelector(".mx_RoomSublist_stickable"); header.style.removeProperty("display"); // always clear display:none first // When an element is <=40% off screen, make it take over @@ -171,8 +171,8 @@ export default class LeftPanel extends React.Component { } if (style.stickyTop) { - if (!header.classList.contains("mx_RoomSublist2_headerContainer_stickyTop")) { - header.classList.add("mx_RoomSublist2_headerContainer_stickyTop"); + if (!header.classList.contains("mx_RoomSublist_headerContainer_stickyTop")) { + header.classList.add("mx_RoomSublist_headerContainer_stickyTop"); } const newTop = `${list.parentElement.offsetTop}px`; @@ -180,8 +180,8 @@ export default class LeftPanel extends React.Component { header.style.top = newTop; } } else { - if (header.classList.contains("mx_RoomSublist2_headerContainer_stickyTop")) { - header.classList.remove("mx_RoomSublist2_headerContainer_stickyTop"); + if (header.classList.contains("mx_RoomSublist_headerContainer_stickyTop")) { + header.classList.remove("mx_RoomSublist_headerContainer_stickyTop"); } if (header.style.top) { header.style.removeProperty('top'); @@ -189,18 +189,18 @@ export default class LeftPanel extends React.Component { } if (style.stickyBottom) { - if (!header.classList.contains("mx_RoomSublist2_headerContainer_stickyBottom")) { - header.classList.add("mx_RoomSublist2_headerContainer_stickyBottom"); + if (!header.classList.contains("mx_RoomSublist_headerContainer_stickyBottom")) { + header.classList.add("mx_RoomSublist_headerContainer_stickyBottom"); } } else { - if (header.classList.contains("mx_RoomSublist2_headerContainer_stickyBottom")) { - header.classList.remove("mx_RoomSublist2_headerContainer_stickyBottom"); + if (header.classList.contains("mx_RoomSublist_headerContainer_stickyBottom")) { + header.classList.remove("mx_RoomSublist_headerContainer_stickyBottom"); } } if (style.stickyTop || style.stickyBottom) { - if (!header.classList.contains("mx_RoomSublist2_headerContainer_sticky")) { - header.classList.add("mx_RoomSublist2_headerContainer_sticky"); + if (!header.classList.contains("mx_RoomSublist_headerContainer_sticky")) { + header.classList.add("mx_RoomSublist_headerContainer_sticky"); } const newWidth = `${headerStickyWidth}px`; @@ -208,8 +208,8 @@ export default class LeftPanel extends React.Component { header.style.width = newWidth; } } else if (!style.stickyTop && !style.stickyBottom) { - if (header.classList.contains("mx_RoomSublist2_headerContainer_sticky")) { - header.classList.remove("mx_RoomSublist2_headerContainer_sticky"); + if (header.classList.contains("mx_RoomSublist_headerContainer_sticky")) { + header.classList.remove("mx_RoomSublist_headerContainer_sticky"); } if (header.style.width) { header.style.removeProperty('width'); diff --git a/src/components/views/rooms/RoomList.tsx b/src/components/views/rooms/RoomList.tsx index 62b24fe137..ff88c7a69d 100644 --- a/src/components/views/rooms/RoomList.tsx +++ b/src/components/views/rooms/RoomList.tsx @@ -29,7 +29,7 @@ import { ITagMap } from "../../../stores/room-list/algorithms/models"; import { DefaultTagID, TagID } from "../../../stores/room-list/models"; import dis from "../../../dispatcher/dispatcher"; import defaultDispatcher from "../../../dispatcher/dispatcher"; -import RoomSublist2 from "./RoomSublist2"; +import RoomSublist from "./RoomSublist"; import { ActionPayload } from "../../../dispatcher/payloads"; import { NameFilterCondition } from "../../../stores/room-list/filters/NameFilterCondition"; import { MatrixClientPeg } from "../../../MatrixClientPeg"; @@ -275,7 +275,7 @@ export default class RoomList extends React.Component { const onAddRoomFn = aesthetics.onAddRoom ? () => aesthetics.onAddRoom(dis) : null; components.push( - { +export default class RoomSublist extends React.Component { private headerButton = createRef(); private sublistRef = createRef(); private dispatcherRef: string; @@ -144,7 +144,7 @@ export default class RoomSublist2 extends React.Component { } private get numTiles(): number { - return RoomSublist2.calcNumTiles(this.props); + return RoomSublist.calcNumTiles(this.props); } private static calcNumTiles(props) { @@ -167,7 +167,7 @@ export default class RoomSublist2 extends React.Component { } // as the rooms can come in one by one we need to reevaluate // the amount of available rooms to cap the amount of requested visible rooms by the layout - if (RoomSublist2.calcNumTiles(prevProps) !== this.numTiles) { + if (RoomSublist.calcNumTiles(prevProps) !== this.numTiles) { this.setState({height: this.calculateInitialHeight()}); } } @@ -329,8 +329,8 @@ export default class RoomSublist2 extends React.Component { // the scrollTop is capped at the height of the header in LeftPanel, the top header is always sticky const isAtTop = list.scrollTop <= HEADER_HEIGHT; const isAtBottom = list.scrollTop >= list.scrollHeight - list.offsetHeight; - const isStickyTop = possibleSticky.classList.contains('mx_RoomSublist2_headerContainer_stickyTop'); - const isStickyBottom = possibleSticky.classList.contains('mx_RoomSublist2_headerContainer_stickyBottom'); + const isStickyTop = possibleSticky.classList.contains('mx_RoomSublist_headerContainer_stickyTop'); + const isStickyBottom = possibleSticky.classList.contains('mx_RoomSublist_headerContainer_stickyBottom'); if ((isStickyBottom && !isAtBottom) || (isStickyTop && !isAtTop)) { // is sticky - jump to list @@ -444,7 +444,7 @@ export default class RoomSublist2 extends React.Component {
-
{_t("Appearance")}
+
{_t("Appearance")}
{ top={this.state.contextMenuPosition.top + this.state.contextMenuPosition.height} onFinished={this.onCloseMenu} > -
+
-
{_t("Sort by")}
+
{_t("Sort by")}
this.onTagSortChanged(SortAlgorithm.Recent)} @@ -500,7 +500,7 @@ export default class RoomSublist2 extends React.Component { return ( { ); } const collapseClasses = classNames({ - 'mx_RoomSublist2_collapseBtn': true, - 'mx_RoomSublist2_collapseBtn_collapsed': !this.state.isExpanded, + 'mx_RoomSublist_collapseBtn': true, + 'mx_RoomSublist_collapseBtn_collapsed': !this.state.isExpanded, }); const classes = classNames({ - 'mx_RoomSublist2_headerContainer': true, - 'mx_RoomSublist2_headerContainer_withAux': !!addRoomButton, + 'mx_RoomSublist_headerContainer': true, + 'mx_RoomSublist_headerContainer_withAux': !!addRoomButton, }); const badgeContainer = ( -
+
{badge}
); @@ -573,12 +573,12 @@ export default class RoomSublist2 extends React.Component { // The same applies to the notification badge. return (
-
+