mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-31 08:44:57 +00:00
refactor(Communities): use StatusInput in CommunitiesPopup
This commit is contained in:
parent
a40fe71767
commit
a7458aba1b
@ -1,8 +1,6 @@
|
|||||||
import QtQuick 2.12
|
import QtQuick 2.12
|
||||||
import QtQuick.Controls 2.3
|
import QtQuick.Controls 2.3
|
||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts 1.3
|
||||||
import QtQml.Models 2.3
|
|
||||||
import QtGraphicalEffects 1.13
|
|
||||||
|
|
||||||
import StatusQ.Core 0.1
|
import StatusQ.Core 0.1
|
||||||
import StatusQ.Core.Theme 0.1
|
import StatusQ.Core.Theme 0.1
|
||||||
@ -17,8 +15,8 @@ StatusModal {
|
|||||||
id: popup
|
id: popup
|
||||||
|
|
||||||
onOpened: {
|
onOpened: {
|
||||||
contentComponent.searchBox.text = "";
|
contentComponent.searchBox.input.text = "";
|
||||||
contentComponent.searchBox.forceActiveFocus(Qt.MouseFocusReason)
|
contentComponent.searchBox.input.forceActiveFocus(Qt.MouseFocusReason)
|
||||||
}
|
}
|
||||||
|
|
||||||
//% "Communities"
|
//% "Communities"
|
||||||
@ -46,23 +44,21 @@ StatusModal {
|
|||||||
width: popup.width
|
width: popup.width
|
||||||
property alias searchBox: searchBox
|
property alias searchBox: searchBox
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
height: 68
|
height: 8
|
||||||
width: parent.width - 32
|
width: parent.width
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
SearchBox {
|
|
||||||
id: searchBox
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
//% "Search for communities or topics"
|
|
||||||
placeholderText: qsTrId("search-for-communities-or-topics")
|
|
||||||
iconWidth: 17
|
|
||||||
iconHeight: 17
|
|
||||||
customHeight: 36
|
|
||||||
fontPixelSize: 15
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusModalDivider {}
|
StatusInput {
|
||||||
|
id: searchBox
|
||||||
|
input.placeholderText: qsTr("Search for communities or topics")
|
||||||
|
input.icon.name: "search"
|
||||||
|
input.height: 36
|
||||||
|
input.topPadding: 9
|
||||||
|
input.bottomPadding: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
StatusModalDivider { topPadding: 8 }
|
||||||
|
|
||||||
ScrollView {
|
ScrollView {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
@ -109,10 +105,10 @@ StatusModal {
|
|||||||
model: chatsModel.communities.list
|
model: chatsModel.communities.list
|
||||||
delegate: StatusListItem {
|
delegate: StatusListItem {
|
||||||
visible: {
|
visible: {
|
||||||
if (!searchBox.text) {
|
if (!searchBox.input.text) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
const lowerCaseSearchStr = searchBox.text.toLowerCase()
|
const lowerCaseSearchStr = searchBox.input.text.toLowerCase()
|
||||||
return name.toLowerCase().includes(lowerCaseSearchStr) || description.toLowerCase().includes(lowerCaseSearchStr)
|
return name.toLowerCase().includes(lowerCaseSearchStr) || description.toLowerCase().includes(lowerCaseSearchStr)
|
||||||
}
|
}
|
||||||
height: visible ? implicitHeight : 0
|
height: visible ? implicitHeight : 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user