diff --git a/src/main/java/com/application/munera/views/MainLayout.java b/src/main/java/com/application/munera/views/MainLayout.java index 78bd1d6..76e67ec 100644 --- a/src/main/java/com/application/munera/views/MainLayout.java +++ b/src/main/java/com/application/munera/views/MainLayout.java @@ -1,6 +1,7 @@ package com.application.munera.views; import com.application.munera.views.expenses.ExpensesView; +import com.application.munera.views.expenses.FormView; import com.vaadin.flow.component.applayout.AppLayout; import com.vaadin.flow.component.applayout.DrawerToggle; import com.vaadin.flow.component.html.Footer; @@ -51,6 +52,7 @@ public class MainLayout extends AppLayout { SideNav nav = new SideNav(); nav.addItem(new SideNavItem("Expenses", ExpensesView.class, LineAwesomeIcon.COLUMNS_SOLID.create())); + nav.addItem(new SideNavItem("Form", FormView.class, LineAwesomeIcon.COLUMNS_SOLID.create())); return nav; } diff --git a/src/main/java/com/application/munera/views/expenses/FormView.java b/src/main/java/com/application/munera/views/expenses/FormView.java new file mode 100644 index 0000000..285e895 --- /dev/null +++ b/src/main/java/com/application/munera/views/expenses/FormView.java @@ -0,0 +1,33 @@ +package com.application.munera.views.expenses; + +import com.vaadin.flow.component.formlayout.FormLayout; +import com.vaadin.flow.component.html.Div; +import com.vaadin.flow.component.textfield.PasswordField; +import com.vaadin.flow.router.Route; + +import java.awt.*; + +@Route("form") +public class FormView extends Div { + + public FormView() { + TextField firstName = new TextField("First name"); + TextField lastName = new TextField("Last name"); + TextField username = new TextField("Username"); + PasswordField password = new PasswordField("Password"); + PasswordField confirmPassword = new PasswordField("Confirm password"); + + FormLayout formLayout = new FormLayout(); + formLayout.add(password); + formLayout.setResponsiveSteps( + // Use one column by default + new com.vaadin.flow.component.formlayout.FormLayout.ResponsiveStep("0", 1), + // Use two columns, if layout's width exceeds 500px + new com.vaadin.flow.component.formlayout.FormLayout.ResponsiveStep("500px", 2)); + // Stretch the username field over 2 columns + formLayout.setColspan(password, 2); + + add(formLayout); + } + +} \ No newline at end of file