package com.example.views;

import com.vaadin.flow.component.checkbox.Checkbox;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.component.html.H1;
import com.vaadin.flow.router.Route;
import com.vaadin.flow.router.RouterLayout;

@Route("")
public class TestView extends Div implements RouterLayout {

    public TestView() {

        final var warning = new Div("This is a warning message.");
        warning.setClassName("warning");
        add(warning);
        
        add(new H1("Lumo Theme Test"));
        
        final var darkModeSwitcher = new Checkbox("Dark mode");
        add(darkModeSwitcher);
        darkModeSwitcher.addValueChangeListener(event -> {
            if (event.getValue()) {
                getElement().getThemeList().add("dark");
            } else {
                getElement().getThemeList().remove("dark");
            }
        });

    }
}
