mirai/ui/components/SideBar.slint

65 lines
1.4 KiB
Text
Raw Normal View History

import { Backend } from "../Backend.slint";
import { VButton, ToggleButton, VActionButton, VText, Svg, Palette } from "@selenite";
2024-08-16 21:35:12 +02:00
export component SideBar inherits Rectangle {
background: Palette.pane;
2024-08-16 21:35:12 +02:00
VerticalLayout {
2024-10-29 15:02:46 +01:00
height: parent.height;
2024-08-16 21:35:12 +02:00
padding: 16px;
spacing: 16px;
HorizontalLayout {
alignment: space-between;
spacing: 64px;
VText {
text: "Sources";
font-size: 1.5rem;
}
VActionButton {
icon-svg: Svg.plus;
icon-colorize: Palette.green;
background: transparent;
clicked => { Backend.add-source-clicked() }
}
2024-08-16 21:35:12 +02:00
}
VerticalLayout {
2024-10-29 15:02:46 +01:00
alignment: space-between;
vertical-stretch: 1;
VerticalLayout {
vertical-stretch: 1;
spacing: 4px;
ToggleButton {
text: "All";
text-alignment: left;
active: Backend.no-source-selected;
clicked => { Backend.source-clicked(-1) }
2024-10-29 15:02:46 +01:00
}
for item[index] in Backend.sources-selected: ToggleButton {
text: item.name;
text-alignment: left;
active: item.selected;
clicked => { Backend.source-clicked(index) }
VActionButton {
visible: parent.active;
icon-svg: Svg.cog;
background: transparent;
clicked => { Backend.edit-source-clicked(item.id) }
}
2024-10-29 15:02:46 +01:00
}
2024-08-16 21:35:12 +02:00
}
VerticalLayout {
2024-10-29 15:02:46 +01:00
spacing: 4px;
/*VButton {
2024-10-29 15:02:46 +01:00
icon-svg: Svg.cog;
text: "Settings";
background: transparent;
clicked => { Backend.settings-clicked() }
}*/
}
2024-08-16 21:35:12 +02:00
}
}
}