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

Commit cce0833

Browse files
authored
Simplify ReplyPreview implementation (#8516)
- Use AccessibleButton for cancel button, following other cases on UI - Use flexbox for RTL layout to remove clear: both Signed-off-by: Suguru Hirahara <[email protected]>
1 parent 4d5a063 commit cce0833

File tree

2 files changed

+28
-34
lines changed

2 files changed

+28
-34
lines changed

res/css/views/rooms/_ReplyPreview.scss

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,31 @@ limitations under the License.
2525

2626
.mx_ReplyPreview_section {
2727
border-bottom: 1px solid $primary-hairline-color;
28+
display: flex;
29+
flex-flow: column;
30+
row-gap: $spacing-8;
31+
padding: $spacing-8 $spacing-8 0 $spacing-8;
2832

2933
.mx_ReplyPreview_header {
30-
margin: 8px;
34+
display: flex;
35+
justify-content: space-between;
36+
column-gap: 8px;
37+
3138
color: $primary-content;
3239
font-weight: 400;
3340
opacity: 0.4;
34-
}
35-
36-
.mx_ReplyPreview_tile {
37-
margin: 0 8px;
38-
}
39-
40-
.mx_ReplyPreview_title {
41-
float: left;
42-
}
43-
44-
.mx_ReplyPreview_cancel {
45-
float: right;
46-
cursor: pointer;
47-
display: flex;
48-
}
4941

50-
.mx_ReplyPreview_clear {
51-
clear: both;
42+
.mx_ReplyPreview_header_cancel {
43+
background-color: $primary-content;
44+
mask: url('$(res)/img/cancel.svg');
45+
mask-repeat: no-repeat;
46+
mask-position: center;
47+
mask-size: 18px;
48+
width: 18px;
49+
height: 18px;
50+
min-width: 18px;
51+
min-height: 18px;
52+
}
5253
}
5354
}
5455
}

src/components/views/rooms/ReplyPreview.tsx

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { _t } from '../../../languageHandler';
2222
import { RoomPermalinkCreator } from "../../../utils/permalinks/Permalinks";
2323
import ReplyTile from './ReplyTile';
2424
import RoomContext, { TimelineRenderingType } from '../../../contexts/RoomContext';
25+
import AccessibleButton from "../elements/AccessibleButton";
2526

2627
function cancelQuoting(context: TimelineRenderingType) {
2728
dis.dispatch({
@@ -44,25 +45,17 @@ export default class ReplyPreview extends React.Component<IProps> {
4445

4546
return <div className="mx_ReplyPreview">
4647
<div className="mx_ReplyPreview_section">
47-
<div className="mx_ReplyPreview_header mx_ReplyPreview_title">
48-
{ _t('Replying') }
49-
</div>
50-
<div className="mx_ReplyPreview_header mx_ReplyPreview_cancel">
51-
<img
52-
className="mx_filterFlipColor"
53-
src={require("../../../../res/img/cancel.svg").default}
54-
width="18"
55-
height="18"
48+
<div className="mx_ReplyPreview_header">
49+
<span>{ _t('Replying') }</span>
50+
<AccessibleButton
51+
className="mx_ReplyPreview_header_cancel"
5652
onClick={() => cancelQuoting(this.context.timelineRenderingType)}
5753
/>
5854
</div>
59-
<div className="mx_ReplyPreview_clear" />
60-
<div className="mx_ReplyPreview_tile">
61-
<ReplyTile
62-
mxEvent={this.props.replyToEvent}
63-
permalinkCreator={this.props.permalinkCreator}
64-
/>
65-
</div>
55+
<ReplyTile
56+
mxEvent={this.props.replyToEvent}
57+
permalinkCreator={this.props.permalinkCreator}
58+
/>
6659
</div>
6760
</div>;
6861
}

0 commit comments

Comments
 (0)