import QtQuick
import qs.config
import qs.widgets

Rectangle {
    id: root

    default property alias contentData: body.data
    property string title: ""
    property string subtitle: ""

    width: parent ? parent.width : 680
    implicitHeight: body.implicitHeight + 30
    radius: Theme.cardRadius + 2
    color: Theme.alpha(Theme.bgPanel, 0.72)
    border.width: 1
    border.color: Theme.alpha(Theme.fg, 0.07)

    PrismEdge {
        anchors.top: parent.top
        anchors.left: parent.left
        anchors.right: parent.right
        inset: root.radius
        opacity: 0.36
    }

    Column {
        id: body
        anchors.left: parent.left
        anchors.right: parent.right
        anchors.top: parent.top
        anchors.margins: 15
        spacing: 0

        Text {
            width: parent.width
            visible: root.title !== ""
            text: root.title
            color: Theme.fg
            font.family: Theme.fontFamily
            font.pixelSize: Theme.fontSizeLarge
            font.weight: Font.DemiBold
            bottomPadding: root.subtitle === "" ? 10 : 3
        }

        Text {
            width: parent.width
            visible: root.subtitle !== ""
            text: root.subtitle
            color: Theme.fgDim
            font.family: Theme.fontFamily
            font.pixelSize: Theme.fontSizeSmall
            wrapMode: Text.WordWrap
            bottomPadding: 12
        }
    }
}
