Refactor calendar component

This commit is contained in:
2025-10-10 16:20:31 -03:00
parent dfe55f34af
commit 92a3907b8f
3 changed files with 138 additions and 21 deletions

View File

@@ -75,13 +75,42 @@ Singleton {
Component {
id: time
StyledText {
property string calendar: (HoverMediator.component.calendar) ? HoverMediator.component.calendar : ""
text: calendar
RowLayout{
id: rowlayoutCalendar
textFormat: Text.AutoText
font.family: Theme.fontFamilyMono
readonly property date now: new Date()
readonly property int prevMonth: now.getMonth() - 1
readonly property int currentMonth: now.getMonth()
readonly property int nextMonth: now.getMonth() + 1
implicitWidth: childrenRect.width
implicitHeight: childrenRect.height
spacing: 20
CalendarComponent {
Layout.fillHeight: true
Layout.fillWidth: true
targetYear: parent.prevMonth < 0 ? parent.now.getFullYear() - 1 : parent.now.getFullYear()
targetMonth: parent.prevMonth < 0 ? 11 : parent.prevMonth
currentDate: parent.now
}
CalendarComponent {
Layout.fillHeight: true
Layout.fillWidth: true
targetYear: parent.now.getFullYear()
targetMonth: parent.currentMonth
currentDate: parent.now
}
CalendarComponent {
Layout.fillHeight: true
Layout.fillWidth: true
targetYear: parent.nextMonth > 11 ? parent.now.getFullYear() + 1 : parent.now.getFullYear()
targetMonth: parent.nextMonth > 11 ? 0 : parent.nextMonth
currentDate: parent.now
}
}
}
@@ -127,9 +156,11 @@ Singleton {
topMargin: Theme.gaps
bottomMargin: Theme.gaps
}
color: Theme.backgroudColor
radius: 25
opacity: 1
Behavior on opacity {
NumberAnimation {
property: "opacity"
@@ -154,6 +185,5 @@ Singleton {
}
}
}
}
}