feat: added sidebars

This commit is contained in:
Sara 2024-12-30 21:26:07 +01:00
parent f8dc3d3bee
commit 740fbb22cd

View file

@ -3,12 +3,12 @@
bool static sidebar_open = true; bool static sidebar_open = true;
Clay_Color const SIDEBAR_COLOR = {120.f, 120.f, 120.f, 255.f}; Clay_Color const SIDEBAR_COLOR = {80.f, 80.f, 80.f, 255.f};
Clay_LayoutConfig const SIDEBAR_LAYOUT = { Clay_LayoutConfig const SIDEBAR_LAYOUT = {
.sizing={ .sizing={
.height=CLAY_SIZING_GROW(), .height=CLAY_SIZING_GROW(),
.width=CLAY_SIZING_FIXED(300) .width=CLAY_SIZING_FIXED(400)
}, },
.layoutDirection=CLAY_TOP_TO_BOTTOM .layoutDirection=CLAY_TOP_TO_BOTTOM
}; };
@ -19,6 +19,7 @@ Clay_RectangleElementConfig const SIDEBAR_RECTANGLE = {
static static
void render_composit_library_sidebar() { void render_composit_library_sidebar() {
if(sidebar_open) {
CLAY(CLAY_ID("Sidebar"), CLAY(CLAY_ID("Sidebar"),
CLAY_LAYOUT(SIDEBAR_LAYOUT), CLAY_LAYOUT(SIDEBAR_LAYOUT),
CLAY_RECTANGLE(SIDEBAR_RECTANGLE) CLAY_RECTANGLE(SIDEBAR_RECTANGLE)
@ -31,20 +32,33 @@ void render_composit_library_sidebar() {
} }
}), }),
CLAY_LAYOUT({ CLAY_LAYOUT({
.sizing={.width=CLAY_SIZING_FIXED(10), .height=CLAY_SIZING_FIXED(40)}, .sizing={.width=CLAY_SIZING_FIXED(20), .height=CLAY_SIZING_FIXED(50)},
}), }),
CLAY_RECTANGLE({ CLAY_RECTANGLE({
.color=SIDEBAR_COLOR, .color=SIDEBAR_COLOR,
.cornerRadius={ .cornerRadius={
.topRight=16, .topRight=6,
.bottomRight=16, .bottomRight=6,
.topLeft=16, .topLeft=0,
.bottomLeft=16 .bottomLeft=0
} }
}) })
) { ) {
} }
} }
} else {
CLAY(CLAY_ID("SidebarTab"),
CLAY_FLOATING({
.attachment={
.element=CLAY_ATTACH_POINT_LEFT_TOP,
.parent=CLAY_ATTACH_POINT_LEFT_TOP
}
}),
CLAY_RECTANGLE({
.color=SIDEBAR_COLOR
})
) {}
}
} }
static static