Repository navigation
Expand file tree
/
Copy pathNoteSummary.qml
More file actions
58 lines (55 loc) · 1.6 KB
/
Copy pathNoteSummary.qml
File metadata and controls
58 lines (55 loc) · 1.6 KB
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
import QtQuick
import "../design"
import "../services/notes/sidebar.js" as Sidebar
// Shared two-line note summary for the notebook and search results.
Column {
id: root
property string title: ""
property bool hasTitle: true
property string preview: ""
property var modified: ""
property color foreground: Color.menu.text
property string fontFamily: Style.font.menuFamily
property int fontSize: Style.font.body
spacing: Style.space(1)
Text {
width: parent.width
text: root.title
textFormat: Text.PlainText
color: root.foreground
font.family: root.fontFamily
font.pixelSize: root.fontSize
font.bold: root.hasTitle
elide: Text.ElideRight
}
Row {
width: parent.width
spacing: Style.spacing.sm
Text {
id: dateLabel
visible: text.length > 0
text: {
var time = Sidebar.timestamp(root.modified)
if (!time) {
return ""
}
var date = new Date(time)
return date.toDateString() === new Date().toDateString()
? Qt.formatTime(date, "HH:mm") : Qt.formatDate(date, "d MMM")
}
textFormat: Text.PlainText
color: Color.token("text.secondary")
font.family: root.fontFamily
font.pixelSize: root.fontSize - 1
}
Text {
width: Math.max(0, parent.width - (dateLabel.visible ? dateLabel.width + parent.spacing : 0))
text: root.preview.replace(/\s+/g, " ").trim()
textFormat: Text.PlainText
color: Style.secondaryText(root.foreground, 0.48)
font.family: root.fontFamily
font.pixelSize: root.fontSize - 1
elide: Text.ElideRight
}
}
}