summaryrefslogtreecommitdiff
path: root/CourseItem.ui.qml
blob: 18bc5d7ae855cffb17c4df5fb803f739212e28a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import QtGraphicalEffects 1.15

ColumnLayout {
	property string imageSource: "https://eduport.webestica.com/assets/images/courses/4by3/08.jpg"
	property string titleText: "Sketch from A to Z: for app designer"
	property string priceText: "$150"
	readonly property bool doesntEmbed: Qt.platform.os === "android"
				|| Qt.platform.os === "linux"
				|| Qt.platform.os === "osx"
				|| Qt.platform.os === "unix"
				|| Qt.platform.os === "windows"

	FontLoader {
		id: heebo
		source: "Heebo/Heebo-Bold.ttf"
	}

	FontLoader {
		id: regular
		source: doesntEmbed ? "" : "Roboto/Roboto-Regular.ttf"
	}

	Rectangle {
		Layout.fillWidth: true
		Layout.topMargin: 16
		Layout.bottomMargin: 16
		height: 1
		border {
			width: .5
			color: "#0a000000"
		}
	}

	GridLayout {
		Layout.topMargin: -16
		rows: width < 576 ? 2 : 1
		columns: width < 576 ? 1 : 2

		Rectangle {
			id: rectangle
			Layout.topMargin: 16
			Layout.fillWidth: true
			implicitHeight: courseItemImage.height
			radius: 5.2

			Image {
				id: courseItemImage
				anchors {
					left: parent.left
					right: parent.right
				}
				source: imageSource
				fillMode: Image.PreserveAspectFit
				layer.enabled: true
				layer.effect: OpacityMask {
					maskSource: Rectangle {
						width: courseItemImage.width
						height: courseItemImage.height
						radius: 5.2
					}
				}
			}
		}

	       ColumnLayout {
			Layout.topMargin: 16

			Label {
				Layout.fillWidth: true
				text: titleText
				font {
					family: heebo.name
					pointSize: 15
				}
			}

			Item {
				Layout.fillWidth: true
				Layout.topMargin: 16
				Label {
					anchors {
						top: parent.top
						left: parent.left
						bottom: parent.bottom
					}
					text: priceText
					color: "#0cbc87"
					font {
						family: doesntEmbed ? "Roboto" : regular.name
						pointSize: 15
					}
				}
		       }
	       }
       }
}