#include "library.h"
#include "clay.h"

bool static sidebar_open = true;

Clay_Color const SIDEBAR_COLOR = {120.f, 120.f, 120.f, 255.f};

Clay_LayoutConfig const SIDEBAR_LAYOUT = {
    .sizing={
        .height=CLAY_SIZING_GROW(),
        .width=CLAY_SIZING_FIXED(300)
    },
    .layoutDirection=CLAY_TOP_TO_BOTTOM
};

Clay_RectangleElementConfig const SIDEBAR_RECTANGLE = {
    .color=SIDEBAR_COLOR,
};

static
void render_composit_library_sidebar() {
    CLAY(CLAY_ID("Sidebar"),
        CLAY_LAYOUT(SIDEBAR_LAYOUT),
        CLAY_RECTANGLE(SIDEBAR_RECTANGLE)
    ) {
        CLAY(CLAY_ID("SidebarTab"),
            CLAY_FLOATING({
                .attachment={
                    .element=CLAY_ATTACH_POINT_LEFT_TOP,
                    .parent=CLAY_ATTACH_POINT_RIGHT_TOP
                }
            }),
            CLAY_LAYOUT({
                .sizing={.width=CLAY_SIZING_FIXED(10), .height=CLAY_SIZING_FIXED(40)},
            }),
            CLAY_RECTANGLE({
                .color=SIDEBAR_COLOR,
                .cornerRadius={
                    .topRight=16,
                    .bottomRight=16,
                    .topLeft=16,
                    .bottomLeft=16
                }
            })
        ) {
        }
    }
}

static
void render_composit_library_content() {
    CLAY(CLAY_ID("Content")) {
    }
}

void render_composit_library() {
    render_composit_library_sidebar();
    render_composit_library_content();
}
