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

Commit 36f2f3e

Browse files
authored
Use MessageActionBar style declarations on pinned message card (#8757)
* Refer mx_MessageActionBar on pinned messages card Normalize mx_MessageActionBar style rules - Allow the varaible (--MessageActionBar-size-button) to be used - Remove redundant declarations Signed-off-by: Suguru Hirahara <[email protected]> * Use variables for normalization Signed-off-by: Suguru Hirahara <[email protected]> * Set class name Signed-off-by: Suguru Hirahara <[email protected]> * Readd the comment Signed-off-by: Suguru Hirahara <[email protected]> * Use Heading size='h4' - Use size='h4' instead of 'h2' as 15px has been specified as the font-size of the header - Use logical values following _Heading.scss - Remove line-height declaration in favor of the default value Signed-off-by: Suguru Hirahara <[email protected]>
1 parent 9111508 commit 36f2f3e

File tree

3 files changed

+25
-29
lines changed

3 files changed

+25
-29
lines changed

res/css/views/messages/_MessageActionBar.scss

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ limitations under the License.
1818
.mx_MessageActionBar {
1919
--MessageActionBar-size-button: 28px;
2020
--MessageActionBar-size-box: 32px; // 28px + 2px (margin) * 2
21+
--MessageActionBar-item-hover-background: $panel-actions;
22+
--MessageActionBar-item-hover-borderRadius: 6px;
23+
--MessageActionBar-item-hover-zIndex: 1;
2124

2225
position: absolute;
2326
visibility: hidden;
@@ -59,9 +62,9 @@ limitations under the License.
5962
margin: 2px;
6063

6164
&:hover {
62-
background: $panel-actions;
63-
border-radius: 6px;
64-
z-index: 1;
65+
background: var(--MessageActionBar-item-hover-background);
66+
border-radius: var(--MessageActionBar-item-hover-borderRadius);
67+
z-index: var(--MessageActionBar-item-hover-zIndex);
6568
}
6669
}
6770
}

res/css/views/right_panel/_PinnedMessagesCard.scss

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,51 +33,43 @@ limitations under the License.
3333
}
3434
}
3535

36-
.mx_PinnedMessagesCard_empty {
36+
.mx_PinnedMessagesCard_empty_wrapper {
3737
display: flex;
3838
height: 100%;
3939

40-
> div {
40+
.mx_PinnedMessagesCard_empty {
4141
height: max-content;
4242
text-align: center;
4343
margin: auto 40px;
4444

4545
.mx_PinnedMessagesCard_MessageActionBar {
4646
pointer-events: none;
47-
display: flex;
48-
height: 32px;
49-
line-height: $font-24px;
50-
border-radius: 8px;
51-
background: $background;
52-
border: 1px solid $input-border-color;
53-
padding: 1px;
5447
width: max-content;
5548
margin: 0 auto;
56-
box-sizing: border-box;
5749

58-
.mx_MessageActionBar_maskButton {
59-
display: inline-block;
60-
position: relative;
50+
// Cancel the default values for non-interactivity
51+
position: unset;
52+
visibility: visible;
53+
cursor: unset;
54+
55+
&::before {
56+
content: unset;
6157
}
6258

6359
.mx_MessageActionBar_optionsButton {
64-
background: $panel-actions;
65-
border-radius: 6px;
66-
z-index: 1;
60+
background: var(--MessageActionBar-item-hover-background);
61+
border-radius: var(--MessageActionBar-item-hover-borderRadius);
62+
z-index: var(--MessageActionBar-item-hover-zIndex);
6763

6864
&::after {
6965
background-color: $primary-content;
7066
}
7167
}
7268
}
7369

74-
> h2 {
75-
font-weight: $font-semi-bold;
76-
font-size: $font-15px;
77-
line-height: $font-24px;
70+
.mx_PinnedMessagesCard_empty_header {
7871
color: $primary-content;
79-
margin-top: 24px;
80-
margin-bottom: 20px;
72+
margin-block: $spacing-24 $spacing-20;
8173
}
8274

8375
> span {

src/components/views/right_panel/PinnedMessagesCard.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import PinnedEventTile from "../rooms/PinnedEventTile";
3232
import { useRoomState } from "../../../hooks/useRoomState";
3333
import RoomContext, { TimelineRenderingType } from "../../../contexts/RoomContext";
3434
import { ReadPinsEventId } from "./types";
35+
import Heading from '../typography/Heading';
3536

3637
interface IProps {
3738
room: Room;
@@ -154,16 +155,16 @@ const PinnedMessagesCard = ({ room, onClose }: IProps) => {
154155
/>
155156
));
156157
} else {
157-
content = <div className="mx_PinnedMessagesCard_empty">
158-
<div>
158+
content = <div className="mx_PinnedMessagesCard_empty_wrapper">
159+
<div className="mx_PinnedMessagesCard_empty">
159160
{ /* XXX: We reuse the classes for simplicity, but deliberately not the components for non-interactivity. */ }
160-
<div className="mx_PinnedMessagesCard_MessageActionBar">
161+
<div className="mx_MessageActionBar mx_PinnedMessagesCard_MessageActionBar">
161162
<div className="mx_MessageActionBar_maskButton mx_MessageActionBar_reactButton" />
162163
<div className="mx_MessageActionBar_maskButton mx_MessageActionBar_replyButton" />
163164
<div className="mx_MessageActionBar_maskButton mx_MessageActionBar_optionsButton" />
164165
</div>
165166

166-
<h2>{ _t("Nothing pinned, yet") }</h2>
167+
<Heading size="h4" className="mx_PinnedMessagesCard_empty_header">{ _t("Nothing pinned, yet") }</Heading>
167168
{ _t("If you have permissions, open the menu on any message and select " +
168169
"<b>Pin</b> to stick them here.", {}, {
169170
b: sub => <b>{ sub }</b>,

0 commit comments

Comments
 (0)