61 lines
1.5 KiB
QML
61 lines
1.5 KiB
QML
import QtQuick 2.5
|
|
import "."
|
|
|
|
// Carte utilisateur (avatar rond + nom). `addCard` affiche la carte « Ajouter un compte ».
|
|
Item {
|
|
id: root
|
|
|
|
property string name: ""
|
|
property bool addCard: false
|
|
property bool highlighted: false
|
|
signal clicked()
|
|
|
|
width: 140
|
|
height: 200
|
|
|
|
Rectangle {
|
|
id: avatar
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
y: Theme.spacingS
|
|
width: 120
|
|
height: 120
|
|
radius: width / 2
|
|
color: root.addCard ? Theme.surface : Theme.avatarColor(root.name)
|
|
border.width: root.highlighted ? 4 : 0
|
|
border.color: Theme.focusBackground
|
|
scale: root.highlighted ? 1.1 : 1
|
|
|
|
Behavior on scale { NumberAnimation { duration: Theme.animFast } }
|
|
|
|
Text {
|
|
anchors.centerIn: parent
|
|
text: root.addCard ? "+" : root.name.charAt(0).toUpperCase()
|
|
color: Theme.text
|
|
font.pixelSize: 48
|
|
font.bold: true
|
|
}
|
|
}
|
|
|
|
Text {
|
|
anchors {
|
|
top: avatar.bottom
|
|
topMargin: Theme.spacingL
|
|
left: parent.left
|
|
right: parent.right
|
|
}
|
|
text: root.name
|
|
horizontalAlignment: Text.AlignHCenter
|
|
wrapMode: Text.WordWrap
|
|
maximumLineCount: 2
|
|
elide: Text.ElideRight
|
|
color: root.highlighted ? Theme.text : Theme.textMuted
|
|
font.pixelSize: Theme.fontBody
|
|
font.bold: root.highlighted
|
|
}
|
|
|
|
MouseArea {
|
|
anchors.fill: parent
|
|
onClicked: root.clicked()
|
|
}
|
|
}
|