Hi everybody
I am using the vaadin base with spring project.
Vaadin 10 + Spring does not load custom-style.html when I navigate from a route (“login”) to route (“main-view”) that happens, however when loading only the main-view java class the styles work
@Route("main-view")
@PageTitle("My Starter Project")
@HtmlImport("frontend://styles/styles-combobox.html")
public class MainView extends VerticalLayout implements RouterLayout {
public MainView() {
MyButton btnButton6=new MyButton();
btnButton6.withCaption("Button Css buttonalerta");
btnButton6.withStyle(Styles.BUTTON_ALERTA);
btnButton6.setId("btn");
add(btnButton6);
}
}
Style
<dom-module id="vaadin-button-styles" theme-for="vaadin-button">
<template>
<style>
:host(.buttonalerta){
background-color: var(--color-rojo);
box-shadow: 0 2px 5px 0 rgba( 0, 0, 0, 0.26);
}
:host(.buttonalerta) [part="label"]
, [part="prefix"]
, [part="suffix"]
{
letter-spacing: .010em;
font-size: 12px;
font-weight: bold;
text-transform: uppercase;
color: var(--color-blanco);
}
</style>
</template>
</dom-module>
My Login
@Route("login")
@PageTitle("My Starter Project")
public class LoginScreen extends FlexLayout {
private TextField username;
private PasswordField password;
private Button login;
private Button forgotPassword;
public LoginScreen() {
buildUI();
username.focus();
}
.
.
.
private void login() {
getUI().get().navigate("main-view");
}
}