From 2441cbc9ac301770c99e9d0ce8850535e8dd56ca Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 17 Jul 2020 15:22:18 -0600 Subject: [PATCH] LeftPanel2 -> LeftPanel --- res/css/_components.scss | 2 +- .../{_LeftPanel2.scss => _LeftPanel.scss} | 42 +++++++++---------- res/css/structures/_MatrixChat.scss | 2 +- res/css/views/rooms/_RoomSublist2.scss | 2 +- res/themes/light/css/_mods.scss | 4 +- .../{LeftPanel2.tsx => LeftPanel.tsx} | 36 ++++++++-------- src/components/structures/LoggedInView.tsx | 4 +- src/components/views/rooms/RoomSublist2.tsx | 2 +- .../src/usecases/create-room.js | 2 +- 9 files changed, 46 insertions(+), 50 deletions(-) rename res/css/structures/{_LeftPanel2.scss => _LeftPanel.scss} (85%) rename src/components/structures/{LeftPanel2.tsx => LeftPanel.tsx} (92%) diff --git a/res/css/_components.scss b/res/css/_components.scss index 77462ad4c1..eabdcd6843 100644 --- a/res/css/_components.scss +++ b/res/css/_components.scss @@ -11,7 +11,7 @@ @import "./structures/_GroupView.scss"; @import "./structures/_HeaderButtons.scss"; @import "./structures/_HomePage.scss"; -@import "./structures/_LeftPanel2.scss"; +@import "./structures/_LeftPanel.scss"; @import "./structures/_MainSplit.scss"; @import "./structures/_MatrixChat.scss"; @import "./structures/_MyGroups.scss"; diff --git a/res/css/structures/_LeftPanel2.scss b/res/css/structures/_LeftPanel.scss similarity index 85% rename from res/css/structures/_LeftPanel2.scss rename to res/css/structures/_LeftPanel.scss index 9603731dd5..b142d6ee3d 100644 --- a/res/css/structures/_LeftPanel2.scss +++ b/res/css/structures/_LeftPanel.scss @@ -14,11 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -// TODO: Rename on launch: https://github.com/vector-im/riot-web/issues/14367 - $tagPanelWidth: 56px; // only applies in this file, used for calculations -.mx_LeftPanel2 { +.mx_LeftPanel { background-color: $roomlist2-bg-color; min-width: 260px; max-width: 50%; @@ -26,7 +24,7 @@ $tagPanelWidth: 56px; // only applies in this file, used for calculations // Create a row-based flexbox for the TagPanel and the room list display: flex; - .mx_LeftPanel2_tagPanelContainer { + .mx_LeftPanel_tagPanelContainer { flex-grow: 0; flex-shrink: 0; flex-basis: $tagPanelWidth; @@ -38,15 +36,15 @@ $tagPanelWidth: 56px; // only applies in this file, used for calculations // TagPanel handles its own CSS } - &:not(.mx_LeftPanel2_hasTagPanel) { - .mx_LeftPanel2_roomListContainer { + &:not(.mx_LeftPanel_hasTagPanel) { + .mx_LeftPanel_roomListContainer { width: 100%; } } // Note: The 'room list' in this context is actually everything that isn't the tag // panel, such as the menu options, breadcrumbs, filtering, etc - .mx_LeftPanel2_roomListContainer { + .mx_LeftPanel_roomListContainer { width: calc(100% - $tagPanelWidth); background-color: $roomlist2-bg-color; @@ -54,7 +52,7 @@ $tagPanelWidth: 56px; // only applies in this file, used for calculations display: flex; flex-direction: column; - .mx_LeftPanel2_userHeader { + .mx_LeftPanel_userHeader { /* 12px top, 12px sides, 20px bottom (using 13px bottom to account * for internal whitespace in the breadcrumbs) */ @@ -66,7 +64,7 @@ $tagPanelWidth: 56px; // only applies in this file, used for calculations flex-direction: column; } - .mx_LeftPanel2_breadcrumbsContainer { + .mx_LeftPanel_breadcrumbsContainer { overflow-y: hidden; overflow-x: scroll; margin: 12px 12px 0 12px; @@ -89,7 +87,7 @@ $tagPanelWidth: 56px; // only applies in this file, used for calculations } } - .mx_LeftPanel2_filterContainer { + .mx_LeftPanel_filterContainer { margin-left: 12px; margin-right: 12px; @@ -99,7 +97,7 @@ $tagPanelWidth: 56px; // only applies in this file, used for calculations display: flex; align-items: center; - .mx_RoomSearch_expanded + .mx_LeftPanel2_exploreButton { + .mx_RoomSearch_expanded + .mx_LeftPanel_exploreButton { // Cheaty way to return the occupied space to the filter input flex-basis: 0; margin: 0; @@ -112,7 +110,7 @@ $tagPanelWidth: 56px; // only applies in this file, used for calculations } } - .mx_LeftPanel2_exploreButton { + .mx_LeftPanel_exploreButton { width: 28px; height: 28px; border-radius: 20px; @@ -136,7 +134,7 @@ $tagPanelWidth: 56px; // only applies in this file, used for calculations } } - .mx_LeftPanel2_roomListWrapper { + .mx_LeftPanel_roomListWrapper { // Create a flexbox to ensure the containing items cause appropriate overflow. display: flex; @@ -145,16 +143,16 @@ $tagPanelWidth: 56px; // only applies in this file, used for calculations min-height: 0; margin-top: 10px; // so we're not up against the search/filter - &.mx_LeftPanel2_roomListWrapper_stickyBottom { + &.mx_LeftPanel_roomListWrapper_stickyBottom { padding-bottom: 32px; } - &.mx_LeftPanel2_roomListWrapper_stickyTop { + &.mx_LeftPanel_roomListWrapper_stickyTop { padding-top: 32px; } } - .mx_LeftPanel2_actualRoomListContainer { + .mx_LeftPanel_actualRoomListContainer { flex-grow: 1; // fill the available space overflow-y: auto; width: 100%; @@ -167,26 +165,26 @@ $tagPanelWidth: 56px; // only applies in this file, used for calculations } // These styles override the defaults for the minimized (66px) layout - &.mx_LeftPanel2_minimized { + &.mx_LeftPanel_minimized { min-width: unset; // We have to forcefully set the width to override the resizer's style attribute. - &.mx_LeftPanel2_hasTagPanel { + &.mx_LeftPanel_hasTagPanel { width: calc(68px + $tagPanelWidth) !important; } - &:not(.mx_LeftPanel2_hasTagPanel) { + &:not(.mx_LeftPanel_hasTagPanel) { width: 68px !important; } - .mx_LeftPanel2_roomListContainer { + .mx_LeftPanel_roomListContainer { width: 68px; - .mx_LeftPanel2_filterContainer { + .mx_LeftPanel_filterContainer { // Organize the flexbox into a centered column layout flex-direction: column; justify-content: center; - .mx_LeftPanel2_exploreButton { + .mx_LeftPanel_exploreButton { margin-left: 0; margin-top: 8px; background-color: transparent; diff --git a/res/css/structures/_MatrixChat.scss b/res/css/structures/_MatrixChat.scss index 08ed9e5559..88b29a96e8 100644 --- a/res/css/structures/_MatrixChat.scss +++ b/res/css/structures/_MatrixChat.scss @@ -66,7 +66,7 @@ limitations under the License. } /* not the left panel, and not the resize handle, so the roomview/groupview/... */ -.mx_MatrixChat > :not(.mx_LeftPanel_container):not(.mx_LeftPanel2):not(.mx_ResizeHandle) { +.mx_MatrixChat > :not(.mx_LeftPanel):not(.mx_ResizeHandle) { background-color: $primary-bg-color; flex: 1 1 0; diff --git a/res/css/views/rooms/_RoomSublist2.scss b/res/css/views/rooms/_RoomSublist2.scss index 77a762b4d8..eac2aa838d 100644 --- a/res/css/views/rooms/_RoomSublist2.scss +++ b/res/css/views/rooms/_RoomSublist2.scss @@ -43,7 +43,7 @@ limitations under the License. // all works by ensuring the header text has a fixed height when sticky so the // fixed height of the container can maintain the scroll position. - // The combined height must be set in the LeftPanel2 component for sticky headers + // The combined height must be set in the LeftPanel component for sticky headers // to work correctly. padding-bottom: 8px; height: 24px; diff --git a/res/themes/light/css/_mods.scss b/res/themes/light/css/_mods.scss index 810e0375ba..54ba7795ee 100644 --- a/res/themes/light/css/_mods.scss +++ b/res/themes/light/css/_mods.scss @@ -5,7 +5,7 @@ // it can be blurred by the tag panel and room list @supports (backdrop-filter: none) { - .mx_LeftPanel2 { + .mx_LeftPanel { background-image: var(--avatar-url); background-repeat: no-repeat; background-size: cover; @@ -16,7 +16,7 @@ backdrop-filter: blur($tagpanel-background-blur-amount); } - .mx_LeftPanel2 .mx_LeftPanel2_roomListContainer { + .mx_LeftPanel .mx_LeftPanel_roomListContainer { backdrop-filter: blur($roomlist-background-blur-amount); } } diff --git a/src/components/structures/LeftPanel2.tsx b/src/components/structures/LeftPanel.tsx similarity index 92% rename from src/components/structures/LeftPanel2.tsx rename to src/components/structures/LeftPanel.tsx index c8ab37e014..a8e763c6ab 100644 --- a/src/components/structures/LeftPanel2.tsx +++ b/src/components/structures/LeftPanel.tsx @@ -36,8 +36,6 @@ import {Key} from "../../Keyboard"; import IndicatorScrollbar from "../structures/IndicatorScrollbar"; import AccessibleTooltipButton from "../views/elements/AccessibleTooltipButton"; -// TODO: Rename on launch: https://github.com/vector-im/riot-web/issues/14367 - interface IProps { isMinimized: boolean; resizeNotifier: ResizeNotifier; @@ -58,7 +56,7 @@ const cssClasses = [ "mx_RoomSublist2_showNButton", ]; -export default class LeftPanel2 extends React.Component { +export default class LeftPanel extends React.Component { private listContainerRef: React.RefObject = createRef(); private tagPanelWatcherRef: string; private focusedElement = null; @@ -222,16 +220,16 @@ export default class LeftPanel2 extends React.Component { // add appropriate sticky classes to wrapper so it has // the necessary top/bottom padding to put the sticky header in - const listWrapper = list.parentElement; // .mx_LeftPanel2_roomListWrapper + const listWrapper = list.parentElement; // .mx_LeftPanel_roomListWrapper if (lastTopHeader) { - listWrapper.classList.add("mx_LeftPanel2_roomListWrapper_stickyTop"); + listWrapper.classList.add("mx_LeftPanel_roomListWrapper_stickyTop"); } else { - listWrapper.classList.remove("mx_LeftPanel2_roomListWrapper_stickyTop"); + listWrapper.classList.remove("mx_LeftPanel_roomListWrapper_stickyTop"); } if (firstBottomHeader) { - listWrapper.classList.add("mx_LeftPanel2_roomListWrapper_stickyBottom"); + listWrapper.classList.add("mx_LeftPanel_roomListWrapper_stickyBottom"); } else { - listWrapper.classList.remove("mx_LeftPanel2_roomListWrapper_stickyBottom"); + listWrapper.classList.remove("mx_LeftPanel_roomListWrapper_stickyBottom"); } } @@ -315,7 +313,7 @@ export default class LeftPanel2 extends React.Component { private renderHeader(): React.ReactNode { return ( -
+
); @@ -325,7 +323,7 @@ export default class LeftPanel2 extends React.Component { if (this.state.showBreadcrumbs && !this.props.isMinimized) { return ( @@ -337,7 +335,7 @@ export default class LeftPanel2 extends React.Component { private renderSearchExplore(): React.ReactNode { return (
{ onEnter={this.onEnter} /> @@ -359,7 +357,7 @@ export default class LeftPanel2 extends React.Component { public render(): React.ReactNode { const tagPanel = !this.state.showTagPanel ? null : ( -
+
); @@ -376,24 +374,24 @@ export default class LeftPanel2 extends React.Component { />; const containerClasses = classNames({ - "mx_LeftPanel2": true, - "mx_LeftPanel2_hasTagPanel": !!tagPanel, - "mx_LeftPanel2_minimized": this.props.isMinimized, + "mx_LeftPanel": true, + "mx_LeftPanel_hasTagPanel": !!tagPanel, + "mx_LeftPanel_minimized": this.props.isMinimized, }); const roomListClasses = classNames( - "mx_LeftPanel2_actualRoomListContainer", + "mx_LeftPanel_actualRoomListContainer", "mx_AutoHideScrollbar", ); return (
{tagPanel} -