Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 1d2965a

Browse files
authored
Tweak bottom of space panel buttons in expanded state (#7213)
1 parent 82ae394 commit 1d2965a

File tree

5 files changed

+54
-22
lines changed

5 files changed

+54
-22
lines changed

res/css/structures/_QuickSettingsButton.scss

+14-5
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,34 @@ limitations under the License.
1616

1717
.mx_QuickSettingsButton {
1818
flex: 0 0 auto;
19-
width: 32px;
20-
height: 32px;
2119
border-radius: 8px;
2220
position: relative;
2321
margin: 12px auto;
22+
color: $secondary-content;
23+
min-width: 32px;
24+
min-height: 32px;
25+
line-height: 32px;
26+
27+
&.expanded {
28+
margin-left: 20px;
29+
padding-left: 44px; // align with toggle collapse button text
30+
padding-right: 8px;
31+
}
2432

2533
&::before {
2634
content: "";
2735
position: absolute;
28-
width: inherit;
29-
height: inherit;
36+
width: 32px;
37+
height: 32px;
38+
left: 0;
3039
mask-image: url('$(res)/img/element-icons/settings.svg');
3140
mask-repeat: no-repeat;
3241
mask-position: center;
3342
mask-size: 16px;
3443
background: $secondary-content;
3544
}
3645

37-
&:hover {
46+
&:not(.expanded):hover {
3847
background-color: $quaternary-content;
3948

4049
&::before {

res/css/structures/_SpacePanel.scss

+26-10
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,34 @@ $activeBorderColor: $secondary-content;
4141
}
4242

4343
.mx_SpacePanel_toggleCollapse {
44-
flex: 0 0 auto;
45-
width: 40px;
46-
height: 40px;
47-
mask-position: center;
48-
mask-size: 32px;
49-
mask-repeat: no-repeat;
50-
margin-left: $gutterSize;
51-
background-color: $tertiary-content;
52-
mask-image: url('$(res)/img/element-icons/expand-space-panel.svg');
44+
margin: 0 auto;
45+
position: relative;
46+
min-width: 32px;
47+
min-height: 32px;
48+
line-height: 32px;
49+
color: $secondary-content;
50+
51+
&::before {
52+
content: "";
53+
position: absolute;
54+
width: 32px;
55+
height: 32px;
56+
left: 0;
57+
mask-position: center;
58+
mask-size: contain;
59+
mask-repeat: no-repeat;
60+
background-color: $secondary-content;
61+
mask-image: url('$(res)/img/element-icons/expand-space-panel.svg');
62+
}
5363

5464
&.expanded {
55-
transform: scaleX(-1);
65+
padding-left: 48px;
66+
padding-right: 8px;
67+
margin-left: $gutterSize;
68+
69+
&::before {
70+
transform: scaleX(-1);
71+
}
5672
}
5773
}
5874

src/components/views/spaces/QuickSettingsButton.tsx

+7-3
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ import SettingsStore from "../../../settings/SettingsStore";
3434
import { SettingLevel } from "../../../settings/SettingLevel";
3535
import dis from "../../../dispatcher/dispatcher";
3636
import { RecheckThemePayload } from "../../../dispatcher/payloads/RecheckThemePayload";
37+
import classNames from "classnames";
3738

38-
const QuickSettingsButton = () => {
39+
const QuickSettingsButton = ({ isPanelCollapsed = false }) => {
3940
const orderedThemes = useMemo(getOrderedThemes, []);
4041
const [menuDisplayed, handle, openMenu, closeMenu] = useContextMenu<HTMLDivElement>();
4142

@@ -137,11 +138,14 @@ const QuickSettingsButton = () => {
137138

138139
return <>
139140
<AccessibleTooltipButton
140-
className="mx_QuickSettingsButton"
141+
className={classNames("mx_QuickSettingsButton", { expanded: !isPanelCollapsed })}
141142
onClick={openMenu}
142143
title={_t("Quick settings")}
143144
inputRef={handle}
144-
/>
145+
forceHide={!isPanelCollapsed}
146+
>
147+
{ !isPanelCollapsed ? _t("Settings") : null }
148+
</AccessibleTooltipButton>
145149

146150
{ contextMenu }
147151
</>;

src/components/views/spaces/SpacePanel.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,11 @@ const SpacePanel = () => {
324324
className={classNames("mx_SpacePanel_toggleCollapse", { expanded: !isPanelCollapsed })}
325325
onClick={() => setPanelCollapsed(!isPanelCollapsed)}
326326
title={isPanelCollapsed ? _t("Expand space panel") : _t("Collapse space panel")}
327-
/>
328-
{ metaSpacesEnabled && <QuickSettingsButton /> }
327+
forceHide={!isPanelCollapsed}
328+
>
329+
{ !isPanelCollapsed ? _t("Collapse") : null }
330+
</AccessibleTooltipButton>
331+
{ metaSpacesEnabled && <QuickSettingsButton isPanelCollapsed={isPanelCollapsed} /> }
329332
</ul>
330333
) }
331334
</RovingTabIndexProvider>

src/i18n/strings/en_EN.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1053,6 +1053,7 @@
10531053
"More options": "More options",
10541054
"Theme": "Theme",
10551055
"Space selection": "Space selection",
1056+
"Settings": "Settings",
10561057
"Delete avatar": "Delete avatar",
10571058
"Delete": "Delete",
10581059
"Upload avatar": "Upload avatar",
@@ -1092,6 +1093,7 @@
10921093
"Other rooms": "Other rooms",
10931094
"Expand space panel": "Expand space panel",
10941095
"Collapse space panel": "Collapse space panel",
1096+
"Collapse": "Collapse",
10951097
"Click to copy": "Click to copy",
10961098
"Copied!": "Copied!",
10971099
"Failed to copy": "Failed to copy",
@@ -1120,7 +1122,6 @@
11201122
"Jump to first unread room.": "Jump to first unread room.",
11211123
"Jump to first invite.": "Jump to first invite.",
11221124
"Expand": "Expand",
1123-
"Collapse": "Collapse",
11241125
"Space options": "Space options",
11251126
"Remove": "Remove",
11261127
"This bridge was provisioned by <user />.": "This bridge was provisioned by <user />.",
@@ -1794,7 +1795,6 @@
17941795
"Low Priority": "Low Priority",
17951796
"Invite People": "Invite People",
17961797
"Copy Room Link": "Copy Room Link",
1797-
"Settings": "Settings",
17981798
"Leave Room": "Leave Room",
17991799
"%(count)s unread messages including mentions.|other": "%(count)s unread messages including mentions.",
18001800
"%(count)s unread messages including mentions.|one": "1 unread mention.",

0 commit comments

Comments
 (0)