2020-07-20 19:29:57 +00:00
|
|
|
import QtQuick 2.13
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared 1.0
|
|
|
|
import shared.panels 1.0
|
2020-07-20 19:29:57 +00:00
|
|
|
|
2021-02-01 20:37:50 +00:00
|
|
|
Rectangle {
|
|
|
|
property alias source: reactionImage.source
|
2020-07-20 19:29:57 +00:00
|
|
|
property int emojiId
|
2021-02-01 20:37:50 +00:00
|
|
|
property bool reactedByUser: false
|
2021-02-02 16:24:45 +00:00
|
|
|
property bool isHovered: false
|
2021-10-01 15:58:36 +00:00
|
|
|
signal closeModal()
|
2021-02-01 20:37:50 +00:00
|
|
|
|
|
|
|
id: root
|
|
|
|
width: reactionImage.width + Style.current.halfPadding
|
|
|
|
height: width
|
|
|
|
color: reactedByUser ? Style.current.secondaryBackground :
|
|
|
|
(isHovered ? Style.current.backgroundHover : Style.current.transparent)
|
|
|
|
border.width: reactedByUser ? 1 : 0
|
|
|
|
border.color: Style.current.borderTertiary
|
|
|
|
radius: Style.current.radius
|
|
|
|
|
|
|
|
SVGImage {
|
|
|
|
id: reactionImage
|
|
|
|
width: 32
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
anchors.centerIn: parent
|
|
|
|
}
|
2020-07-20 19:29:57 +00:00
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
2021-02-01 20:37:50 +00:00
|
|
|
hoverEnabled: !reactedByUser
|
|
|
|
onEntered: root.isHovered = true
|
|
|
|
onExited: root.isHovered = false
|
2020-07-20 19:29:57 +00:00
|
|
|
onClicked: {
|
2021-10-01 15:58:36 +00:00
|
|
|
root.closeModal();
|
2020-07-20 19:29:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|