Tweak bottom of space panel buttons in expanded state (#7213)

pull/21833/head
Michael Telatynski 2021-11-29 20:10:34 +00:00 committed by GitHub
parent 82ae39435c
commit 1d2965a111
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 54 additions and 22 deletions

View File

@ -16,17 +16,26 @@ limitations under the License.
.mx_QuickSettingsButton { .mx_QuickSettingsButton {
flex: 0 0 auto; flex: 0 0 auto;
width: 32px;
height: 32px;
border-radius: 8px; border-radius: 8px;
position: relative; position: relative;
margin: 12px auto; margin: 12px auto;
color: $secondary-content;
min-width: 32px;
min-height: 32px;
line-height: 32px;
&.expanded {
margin-left: 20px;
padding-left: 44px; // align with toggle collapse button text
padding-right: 8px;
}
&::before { &::before {
content: ""; content: "";
position: absolute; position: absolute;
width: inherit; width: 32px;
height: inherit; height: 32px;
left: 0;
mask-image: url('$(res)/img/element-icons/settings.svg'); mask-image: url('$(res)/img/element-icons/settings.svg');
mask-repeat: no-repeat; mask-repeat: no-repeat;
mask-position: center; mask-position: center;
@ -34,7 +43,7 @@ limitations under the License.
background: $secondary-content; background: $secondary-content;
} }
&:hover { &:not(.expanded):hover {
background-color: $quaternary-content; background-color: $quaternary-content;
&::before { &::before {

View File

@ -41,18 +41,34 @@ $activeBorderColor: $secondary-content;
} }
.mx_SpacePanel_toggleCollapse { .mx_SpacePanel_toggleCollapse {
flex: 0 0 auto; margin: 0 auto;
width: 40px; position: relative;
height: 40px; min-width: 32px;
mask-position: center; min-height: 32px;
mask-size: 32px; line-height: 32px;
mask-repeat: no-repeat; color: $secondary-content;
margin-left: $gutterSize;
background-color: $tertiary-content; &::before {
mask-image: url('$(res)/img/element-icons/expand-space-panel.svg'); content: "";
position: absolute;
width: 32px;
height: 32px;
left: 0;
mask-position: center;
mask-size: contain;
mask-repeat: no-repeat;
background-color: $secondary-content;
mask-image: url('$(res)/img/element-icons/expand-space-panel.svg');
}
&.expanded { &.expanded {
transform: scaleX(-1); padding-left: 48px;
padding-right: 8px;
margin-left: $gutterSize;
&::before {
transform: scaleX(-1);
}
} }
} }

View File

@ -34,8 +34,9 @@ import SettingsStore from "../../../settings/SettingsStore";
import { SettingLevel } from "../../../settings/SettingLevel"; import { SettingLevel } from "../../../settings/SettingLevel";
import dis from "../../../dispatcher/dispatcher"; import dis from "../../../dispatcher/dispatcher";
import { RecheckThemePayload } from "../../../dispatcher/payloads/RecheckThemePayload"; import { RecheckThemePayload } from "../../../dispatcher/payloads/RecheckThemePayload";
import classNames from "classnames";
const QuickSettingsButton = () => { const QuickSettingsButton = ({ isPanelCollapsed = false }) => {
const orderedThemes = useMemo(getOrderedThemes, []); const orderedThemes = useMemo(getOrderedThemes, []);
const [menuDisplayed, handle, openMenu, closeMenu] = useContextMenu<HTMLDivElement>(); const [menuDisplayed, handle, openMenu, closeMenu] = useContextMenu<HTMLDivElement>();
@ -137,11 +138,14 @@ const QuickSettingsButton = () => {
return <> return <>
<AccessibleTooltipButton <AccessibleTooltipButton
className="mx_QuickSettingsButton" className={classNames("mx_QuickSettingsButton", { expanded: !isPanelCollapsed })}
onClick={openMenu} onClick={openMenu}
title={_t("Quick settings")} title={_t("Quick settings")}
inputRef={handle} inputRef={handle}
/> forceHide={!isPanelCollapsed}
>
{ !isPanelCollapsed ? _t("Settings") : null }
</AccessibleTooltipButton>
{ contextMenu } { contextMenu }
</>; </>;

View File

@ -324,8 +324,11 @@ const SpacePanel = () => {
className={classNames("mx_SpacePanel_toggleCollapse", { expanded: !isPanelCollapsed })} className={classNames("mx_SpacePanel_toggleCollapse", { expanded: !isPanelCollapsed })}
onClick={() => setPanelCollapsed(!isPanelCollapsed)} onClick={() => setPanelCollapsed(!isPanelCollapsed)}
title={isPanelCollapsed ? _t("Expand space panel") : _t("Collapse space panel")} title={isPanelCollapsed ? _t("Expand space panel") : _t("Collapse space panel")}
/> forceHide={!isPanelCollapsed}
{ metaSpacesEnabled && <QuickSettingsButton /> } >
{ !isPanelCollapsed ? _t("Collapse") : null }
</AccessibleTooltipButton>
{ metaSpacesEnabled && <QuickSettingsButton isPanelCollapsed={isPanelCollapsed} /> }
</ul> </ul>
) } ) }
</RovingTabIndexProvider> </RovingTabIndexProvider>

View File

@ -1053,6 +1053,7 @@
"More options": "More options", "More options": "More options",
"Theme": "Theme", "Theme": "Theme",
"Space selection": "Space selection", "Space selection": "Space selection",
"Settings": "Settings",
"Delete avatar": "Delete avatar", "Delete avatar": "Delete avatar",
"Delete": "Delete", "Delete": "Delete",
"Upload avatar": "Upload avatar", "Upload avatar": "Upload avatar",
@ -1092,6 +1093,7 @@
"Other rooms": "Other rooms", "Other rooms": "Other rooms",
"Expand space panel": "Expand space panel", "Expand space panel": "Expand space panel",
"Collapse space panel": "Collapse space panel", "Collapse space panel": "Collapse space panel",
"Collapse": "Collapse",
"Click to copy": "Click to copy", "Click to copy": "Click to copy",
"Copied!": "Copied!", "Copied!": "Copied!",
"Failed to copy": "Failed to copy", "Failed to copy": "Failed to copy",
@ -1120,7 +1122,6 @@
"Jump to first unread room.": "Jump to first unread room.", "Jump to first unread room.": "Jump to first unread room.",
"Jump to first invite.": "Jump to first invite.", "Jump to first invite.": "Jump to first invite.",
"Expand": "Expand", "Expand": "Expand",
"Collapse": "Collapse",
"Space options": "Space options", "Space options": "Space options",
"Remove": "Remove", "Remove": "Remove",
"This bridge was provisioned by <user />.": "This bridge was provisioned by <user />.", "This bridge was provisioned by <user />.": "This bridge was provisioned by <user />.",
@ -1794,7 +1795,6 @@
"Low Priority": "Low Priority", "Low Priority": "Low Priority",
"Invite People": "Invite People", "Invite People": "Invite People",
"Copy Room Link": "Copy Room Link", "Copy Room Link": "Copy Room Link",
"Settings": "Settings",
"Leave Room": "Leave Room", "Leave Room": "Leave Room",
"%(count)s unread messages including mentions.|other": "%(count)s unread messages including mentions.", "%(count)s unread messages including mentions.|other": "%(count)s unread messages including mentions.",
"%(count)s unread messages including mentions.|one": "1 unread mention.", "%(count)s unread messages including mentions.|one": "1 unread mention.",