status-desktop/ui/shared/AddressSourceSelector.qml
emizzle d07daac377
feat/tx-comps: Add RecipientSelector component
Based on the spec in https://www.notion.so/emizzle/Wallet-transaction-components-2003b78a8d0d41c4ab3d21eb2496fb20, this component handles user input for a recipient address, which can be sourced from manual address input, ENS name, contact selection, or another of the user's wallet accounts.
2020-08-13 09:28:35 +02:00

68 lines
2.0 KiB
QML

import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
import QtGraphicalEffects 1.13
import "../imports"
Item {
id: root
property var sources: []
property string selectedSource: sources[0] || "Address"
property int dropdownWidth: 220
height: select.height
Select {
id: select
anchors.left: parent.left
anchors.right: parent.right
model: root.sources
selectedItemView: Item {
anchors.fill: parent
StyledText {
id: selectedTextField
text: root.selectedSource
anchors.left: parent.left
anchors.leftMargin: Style.current.padding
anchors.verticalCenter: parent.verticalCenter
font.pixelSize: 15
verticalAlignment: Text.AlignVCenter
height: 24
}
}
menu.width: dropdownWidth
menu.topPadding: 8
menu.bottomPadding: 8
menu.delegate: Component {
MenuItem {
id: menuItem
height: 40
width: parent.width
onTriggered: function () {
root.selectedSource = root.sources[index]
}
StyledText {
id: itemText
text: root.sources[index]
anchors.left: parent.left
anchors.leftMargin: Style.current.padding
anchors.verticalCenter: parent.verticalCenter
font.pixelSize: 15
height: 22
color: menuItem.highlighted ? Style.current.primaryMenuItemTextHover : Style.current.textColor
}
background: Rectangle {
color: menuItem.highlighted ? Style.current.primaryMenuItemHover : Style.current.transparent
}
}
}
}
}
/*##^##
Designer {
D{i:0;autoSize:true;height:480;width:640}
}
##^##*/