mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-10 14:26:34 +00:00
refactor: make ChatButtons a Row to not have to position them manually
This commit is contained in:
parent
8ac2d66f63
commit
59cba0f125
@ -6,23 +6,18 @@ import "../../../../shared"
|
||||
import "../components"
|
||||
import "./ChatComponents"
|
||||
|
||||
Item {
|
||||
Row {
|
||||
property int iconPadding: 6
|
||||
property var addToChat: function () {}
|
||||
property var onSend: function () {}
|
||||
|
||||
id: chatButtonsContainer
|
||||
|
||||
width: {
|
||||
var w = chatSendBtn.width + emojiIconContainer.width + 2 * iconPadding
|
||||
if(stickerIconContainer.visible) {
|
||||
w += stickerIconContainer.width + 2 * iconPadding;
|
||||
}
|
||||
if(imageIconContainer.visible) {
|
||||
w += imageIconContainer.width + 2 * iconPadding;
|
||||
}
|
||||
return w;
|
||||
}
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Style.current.padding
|
||||
spacing: Style.current.padding / 2
|
||||
|
||||
width: childrenRect.width
|
||||
|
||||
Button {
|
||||
id: chatSendBtn
|
||||
@ -30,9 +25,7 @@ Item {
|
||||
width: 30
|
||||
height: 30
|
||||
text: ""
|
||||
anchors.rightMargin: Style.current.padding
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: parent.right
|
||||
onClicked: {
|
||||
onSend();
|
||||
}
|
||||
@ -52,12 +45,6 @@ Item {
|
||||
ChatInputButton {
|
||||
id: emojiIconContainer
|
||||
source: "../../../img/emojiBtn.svg"
|
||||
anchors.right: {
|
||||
if(stickerIconContainer.visible) return stickerIconContainer.left;
|
||||
if(imageIconContainer.visible) return imageIconContainer.left;
|
||||
return chatSendBtn.left;
|
||||
}
|
||||
anchors.rightMargin: Style.current.padding - chatButtonsContainer.iconPadding * 2
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
opened: emojiPopup.opened
|
||||
close: function () {
|
||||
@ -72,8 +59,6 @@ Item {
|
||||
id: stickerIconContainer
|
||||
visible: !chatColumn.isExtendedInput && txtData.length == 0
|
||||
source: "../../../img/stickers_icon.svg"
|
||||
anchors.right: imageIconContainer.visible ? imageIconContainer.left : parent.right
|
||||
anchors.rightMargin: Style.current.padding - chatButtonsContainer.iconPadding * (imageIconContainer.visible ? 2 : 1)
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
opened: stickersPopup.opened
|
||||
close: function () {
|
||||
@ -88,8 +73,6 @@ Item {
|
||||
id: imageIconContainer
|
||||
visible: !chatColumn.isExtendedInput && (chatsModel.activeChannel.chatType === Constants.chatTypePrivateGroupChat || chatsModel.activeChannel.chatType === Constants.chatTypeOneToOne)
|
||||
source: "../../../img/images_icon.svg"
|
||||
anchors.right: chatSendBtn.visible ? chatSendBtn.left : parent.right
|
||||
anchors.rightMargin: Style.current.padding - chatButtonsContainer.iconPadding
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
opened: imageDialog.visible
|
||||
close: function () {
|
||||
|
Loading…
x
Reference in New Issue
Block a user