Skip to content

Commit d55d365

Browse files
committed
Use classNames instead of inline style
Theres no benefit to using inline styles
1 parent 3481283 commit d55d365

2 files changed

Lines changed: 18 additions & 8 deletions

File tree

‎src/components/views/rooms/DNDRoomTile.js‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,19 @@ import React from 'react';
1818
import { Draggable } from 'react-beautiful-dnd';
1919
import RoomTile from 'matrix-react-sdk/lib/components/views/rooms/RoomTile';
2020

21+
import classNames from 'classnames';
22+
2123
export default class DNDRoomTile extends React.Component {
2224
constructor() {
2325
super();
24-
this.getStyle = this.getStyle.bind(this);
26+
this.getClassName = this.getClassName.bind(this);
2527
}
2628

27-
getStyle(isDragging) {
28-
const result = {
29-
transform: isDragging ? "scale(1.05, 1.05)" : "none",
30-
transition: "transform 0.2s",
31-
};
32-
return result;
29+
getClassName(isDragging) {
30+
return classNames({
31+
"mx_DNDRoomTile": true,
32+
"mx_DNDRoomTile_dragging": isDragging,
33+
});
3334
}
3435

3536
render() {
@@ -49,7 +50,7 @@ export default class DNDRoomTile extends React.Component {
4950
{...provided.draggableProps}
5051
{...provided.dragHandleProps}
5152
>
52-
<div style={this.getStyle(snapshot.isDragging)}>
53+
<div className={this.getClassName(snapshot.isDragging)}>
5354
<RoomTile {...props} />
5455
</div>
5556
</div>

‎src/skins/vector/css/matrix-react-sdk/views/rooms/_RoomTile.scss‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,15 @@ limitations under the License.
157157
background-color: $roomtile-selected-bg-color;
158158
}
159159

160+
.mx_DNDRoomTile {
161+
transform: none;
162+
transition: transform 0.2s;
163+
}
164+
165+
.mx_DNDRoomTile_dragging {
166+
transform: scale(1.05, 1.05);
167+
}
168+
160169
.mx_RoomTile:focus {
161170
filter: none ! important;
162171
background-color: $roomtile-focused-bg-color;

0 commit comments

Comments
 (0)