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

Commit 8418b4f

Browse files
Move KeyboardShortcut styling into a separate file (#8067)
1 parent 22712d3 commit 8418b4f

File tree

6 files changed

+53
-24
lines changed

6 files changed

+53
-24
lines changed

res/css/_components.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@
277277
@import "./views/settings/_ImageSizePanel.scss";
278278
@import "./views/settings/_IntegrationManager.scss";
279279
@import "./views/settings/_JoinRuleSettings.scss";
280+
@import "./views/settings/_KeyboardShortcut.scss";
280281
@import "./views/settings/_LayoutSwitcher.scss";
281282
@import "./views/settings/_Notifications.scss";
282283
@import "./views/settings/_PhoneNumbers.scss";
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
Copyright 2020 The Matrix.org Foundation C.I.C.
3+
Copyright 2021 Šimon Brandner <[email protected]>
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
*/
17+
18+
.mx_KeyboardShortcut {
19+
kbd {
20+
padding: 5px;
21+
border-radius: 4px;
22+
background-color: $header-panel-bg-color;
23+
margin-right: 5px;
24+
min-width: 20px;
25+
text-align: center;
26+
display: inline-block;
27+
border: 1px solid $kbd-border-color;
28+
box-shadow: 0 2px $kbd-border-color;
29+
margin-bottom: 4px;
30+
text-transform: capitalize;
31+
32+
& + kbd {
33+
margin-left: 5px;
34+
}
35+
}
36+
}

res/css/views/settings/tabs/user/_KeyboardUserSettingsTab.scss

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,4 @@ limitations under the License.
2121
justify-content: space-between;
2222
align-items: center;
2323
}
24-
25-
kbd {
26-
padding: 5px;
27-
border-radius: 4px;
28-
background-color: $header-panel-bg-color;
29-
margin-right: 5px;
30-
min-width: 20px;
31-
text-align: center;
32-
display: inline-block;
33-
border: 1px solid $kbd-border-color;
34-
box-shadow: 0 2px $kbd-border-color;
35-
margin-bottom: 4px;
36-
text-transform: capitalize;
37-
38-
& + kbd {
39-
margin-left: 5px;
40-
}
41-
}
4224
}

src/components/views/settings/KeyboardShortcut.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export const KeyboardShortcut: React.FC<IKeyboardShortcutProps> = ({ value }) =>
5858
modifiersElement.push(<KeyboardKey key="shiftKey" name={Key.SHIFT} />);
5959
}
6060

61-
return <div>
61+
return <div className="mx_KeyboardShortcut">
6262
{ modifiersElement }
6363
<KeyboardKey name={value.key} last />
6464
</div>;

test/components/views/settings/__snapshots__/KeyboardShortcut-test.tsx.snap

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ exports[`KeyboardShortcut doesn't render same modifier twice 1`] = `
2323
}
2424
}
2525
>
26-
<div>
26+
<div
27+
className="mx_KeyboardShortcut"
28+
>
2729
<KeyboardKey
2830
key="ctrlOrCmdKey"
2931
name="Control"
@@ -59,7 +61,9 @@ exports[`KeyboardShortcut doesn't render same modifier twice 2`] = `
5961
}
6062
}
6163
>
62-
<div>
64+
<div
65+
className="mx_KeyboardShortcut"
66+
>
6367
<KeyboardKey
6468
key="ctrlOrCmdKey"
6569
name="Control"

test/components/views/settings/tabs/user/__snapshots__/KeyboardUserSettingsTab-test.tsx.snap

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ exports[`KeyboardUserSettingsTab renders list of keyboard shortcuts 1`] = `
5050
}
5151
}
5252
>
53-
<div>
53+
<div
54+
className="mx_KeyboardShortcut"
55+
>
5456
<KeyboardKey
5557
key="ctrlKey"
5658
name="Control"
@@ -92,7 +94,9 @@ exports[`KeyboardUserSettingsTab renders list of keyboard shortcuts 1`] = `
9294
}
9395
}
9496
>
95-
<div>
97+
<div
98+
className="mx_KeyboardShortcut"
99+
>
96100
<KeyboardKey
97101
key="ctrlKey"
98102
name="Control"
@@ -160,7 +164,9 @@ exports[`KeyboardUserSettingsTab renders list of keyboard shortcuts 1`] = `
160164
}
161165
}
162166
>
163-
<div>
167+
<div
168+
className="mx_KeyboardShortcut"
169+
>
164170
<KeyboardKey
165171
last={true}
166172
name="Enter"

0 commit comments

Comments
 (0)