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

Use MessageActionBar style declarations on pinned message card #8757

Merged
merged 7 commits into from
Jun 8, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions res/css/views/messages/_MessageActionBar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ limitations under the License.
.mx_MessageActionBar {
--MessageActionBar-size-button: 28px;
--MessageActionBar-size-box: 32px; // 28px + 2px (margin) * 2
--MessageActionBar-item-hover-background: $panel-actions;
--MessageActionBar-item-hover-borderRadius: 6px;
--MessageActionBar-item-hover-zIndex: 1;

position: absolute;
visibility: hidden;
Expand Down Expand Up @@ -59,9 +62,9 @@ limitations under the License.
margin: 2px;

&:hover {
background: $panel-actions;
border-radius: 6px;
z-index: 1;
background: var(--MessageActionBar-item-hover-background);
border-radius: var(--MessageActionBar-item-hover-borderRadius);
z-index: var(--MessageActionBar-item-hover-zIndex);
}
}
}
Expand Down
30 changes: 13 additions & 17 deletions res/css/views/right_panel/_PinnedMessagesCard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,45 +33,41 @@ limitations under the License.
}
}

.mx_PinnedMessagesCard_empty {
.mx_PinnedMessagesCard_empty_wrapper {
display: flex;
height: 100%;

> div {
.mx_PinnedMessagesCard_empty {
height: max-content;
text-align: center;
margin: auto 40px;

.mx_PinnedMessagesCard_MessageActionBar {
pointer-events: none;
display: flex;
height: 32px;
line-height: $font-24px;
border-radius: 8px;
background: $background;
border: 1px solid $input-border-color;
padding: 1px;
width: max-content;
margin: 0 auto;
box-sizing: border-box;

.mx_MessageActionBar_maskButton {
display: inline-block;
position: relative;
// Cancel the default values for non-interactivity
position: unset;
visibility: visible;
cursor: unset;

&::before {
content: unset;
}

.mx_MessageActionBar_optionsButton {
background: $panel-actions;
border-radius: 6px;
z-index: 1;
background: var(--MessageActionBar-item-hover-background);
border-radius: var(--MessageActionBar-item-hover-borderRadius);
z-index: var(--MessageActionBar-item-hover-zIndex);

&::after {
background-color: $primary-content;
}
}
}

> h2 {
.mx_PinnedMessagesCard_empty_header {
font-weight: $font-semi-bold;
font-size: $font-15px;
line-height: $font-24px;
Expand Down
9 changes: 4 additions & 5 deletions src/components/views/right_panel/PinnedMessagesCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,15 @@ const PinnedMessagesCard = ({ room, onClose }: IProps) => {
/>
));
} else {
content = <div className="mx_PinnedMessagesCard_empty">
<div>
{ /* XXX: We reuse the classes for simplicity, but deliberately not the components for non-interactivity. */ }
luixxiul marked this conversation as resolved.
Show resolved Hide resolved
<div className="mx_PinnedMessagesCard_MessageActionBar">
content = <div className="mx_PinnedMessagesCard_empty_wrapper">
<div className="mx_PinnedMessagesCard_empty">
<div className="mx_MessageActionBar mx_PinnedMessagesCard_MessageActionBar">
<div className="mx_MessageActionBar_maskButton mx_MessageActionBar_reactButton" />
<div className="mx_MessageActionBar_maskButton mx_MessageActionBar_replyButton" />
<div className="mx_MessageActionBar_maskButton mx_MessageActionBar_optionsButton" />
</div>

<h2>{ _t("Nothing pinned, yet") }</h2>
<h2 className="mx_PinnedMessagesCard_empty_header">{ _t("Nothing pinned, yet") }</h2>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{ _t("If you have permissions, open the menu on any message and select " +
"<b>Pin</b> to stick them here.", {}, {
b: sub => <b>{ sub }</b>,
Expand Down