diff options
| author | ATMDA <atdma2600@gmail.com> | 2025-11-12 15:58:42 -0500 |
|---|---|---|
| committer | ATMDA <atdma2600@gmail.com> | 2025-11-12 15:58:42 -0500 |
| commit | e92187293e4afa046ca05bd80796c1fa193097e5 (patch) | |
| tree | cc9fae7544271ff03c3eb2515bc8daa0c9e1cdcd /components/controls/CollapsibleSection.qml | |
| parent | notifs/toasts: reworked notifications and toasts and how they display and wor... (diff) | |
| download | caelestia-shell-e92187293e4afa046ca05bd80796c1fa193097e5.tar.gz caelestia-shell-e92187293e4afa046ca05bd80796c1fa193097e5.tar.bz2 caelestia-shell-e92187293e4afa046ca05bd80796c1fa193097e5.zip | |
controlcenter: refactoring into components
Diffstat (limited to 'components/controls/CollapsibleSection.qml')
| -rw-r--r-- | components/controls/CollapsibleSection.qml | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/components/controls/CollapsibleSection.qml b/components/controls/CollapsibleSection.qml new file mode 100644 index 0000000..945386c --- /dev/null +++ b/components/controls/CollapsibleSection.qml @@ -0,0 +1,85 @@ +import ".." +import qs.components +import qs.components.effects +import qs.services +import qs.config +import QtQuick +import QtQuick.Layouts + +ColumnLayout { + id: root + + required property string title + property string description: "" + property bool expanded: false + + signal toggleRequested + + spacing: Appearance.spacing.small / 2 + Layout.fillWidth: true + + Item { + id: sectionHeaderItem + Layout.fillWidth: true + Layout.preferredHeight: sectionHeader.implicitHeight + + ColumnLayout { + id: sectionHeader + anchors.left: parent.left + anchors.right: parent.right + spacing: Appearance.spacing.small + + RowLayout { + Layout.fillWidth: true + spacing: Appearance.spacing.small + + StyledText { + Layout.topMargin: Appearance.spacing.large + text: root.title + font.pointSize: Appearance.font.size.larger + font.weight: 500 + } + + Item { + Layout.fillWidth: true + } + + MaterialIcon { + text: "expand_more" + rotation: root.expanded ? 180 : 0 + color: Colours.palette.m3onSurface + Behavior on rotation { + Anim {} + } + } + } + + StateLayer { + anchors.fill: parent + anchors.leftMargin: -Appearance.padding.normal + anchors.rightMargin: -Appearance.padding.normal + function onClicked(): void { + root.toggleRequested(); + root.expanded = !root.expanded; + } + } + + StyledText { + visible: root.expanded && root.description !== "" + text: root.description + color: Colours.palette.m3outline + Layout.fillWidth: true + } + } + } + + default property alias content: contentColumn.data + + ColumnLayout { + id: contentColumn + Layout.fillWidth: true + visible: root.expanded + spacing: Appearance.spacing.small / 2 + } +} + |