Skip to content

Commit

Permalink
fix sidebar width
Browse files Browse the repository at this point in the history
  • Loading branch information
mrFreeman-G committed Aug 28, 2023
1 parent 7585c7e commit 5c2983f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
13 changes: 1 addition & 12 deletions rocketchat.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
:root {
--sidebar-width: 400px;
--sidebar-folders-width: 85px;


--bg-image-1: url(https://blog.1a23.com/wp-content/uploads/sites/2/2020/02/pattern_03-150x150.png);
--bg-image-2: url(https://w0.peakpx.com/wallpaper/154/372/HD-wallpaper-telegram-background-whatsapp-creative-android-pattern-texture-abstract.jpg);
--bg-image-3: url(https://w0.peakpx.com/wallpaper/816/695/HD-wallpaper-whatsapp-cartoons-background-blue-cartoons-green-pink-purple-walpaper-whatsapp.jpg);
Expand Down Expand Up @@ -184,14 +182,6 @@ html[data-palette-dark="palette-darker"] {

}

/*
html[data-theme="telegram"]
html[data-bg="bg-1"]
html[data-palette-light="palette-2"]
html[data-palette-dark="palette-2"]
*/




/*
Expand Down Expand Up @@ -901,7 +891,7 @@ span.rcx-message__emoji.emoji.rcx-message__emoji--big[style*="background-image"]
/* sidebar main container */
div#sidebar-region {
max-width: 400px !important;
flex: 0 0 var(--sidebar-width) !important;
/* flex: 0 0 var(--sidebar-width) !important; */
}

/* sidebar > items padding's */
Expand Down Expand Up @@ -1715,7 +1705,6 @@ html[data-theme="flat"] ul.thread {
display: flex;
flex-direction: column;
align-content: stretch;
/* flex-wrap: wrap; */
flex-wrap: nowrap;
align-items: stretch;
justify-content: flex-start;
Expand Down
10 changes: 7 additions & 3 deletions rocketchat.js
Original file line number Diff line number Diff line change
Expand Up @@ -708,13 +708,17 @@ async function setupNavbar(navbarItemsContainer) {
navbarItemsContainer.setAttribute("folder-label-area", allChatsLabel);

const sidebarWidth = getComputedStyle(root).getPropertyValue("--sidebar-width");
const sidebarWidthMd = getComputedStyle(root).getPropertyValue("--sidebar-md-width");
const sidebarWidthLg = getComputedStyle(root).getPropertyValue("--sidebar-lg-width");
const sidebarFoldersWidth = getComputedStyle(root).getPropertyValue("--sidebar-folders-width");

// set sidebar width
const newSidebarWidth = `calc(${sidebarWidth} + ${sidebarFoldersWidth})`;
if (sidebarWidth != newSidebarWidth) {
root.style.setProperty("--sidebar-width", newSidebarWidth);
}
const newSidebarWidthMd = `calc(${sidebarWidthMd} + ${sidebarFoldersWidth})`;
const newSidebarWidthLg = `calc(${sidebarWidthLg} + ${sidebarFoldersWidth})`;
root.style.setProperty("--sidebar-width", newSidebarWidth);
root.style.setProperty("--sidebar-md-width", newSidebarWidthMd);
root.style.setProperty("--sidebar-lg-width", newSidebarWidthLg);

// setup folders sidebar container
const chatsContainer = document.querySelector('nav.rcx-sidebar div[aria-label][role="region"]');
Expand Down

0 comments on commit 5c2983f

Please sign in to comment.