Skip to content

Instantly share code, notes, and snippets.

@mstahv
Created August 23, 2024 07:12
Show Gist options
  • Save mstahv/a669a8ae76aeef622d4b597513c9e336 to your computer and use it in GitHub Desktop.
Save mstahv/a669a8ae76aeef622d4b597513c9e336 to your computer and use it in GitHub Desktop.
package org.peimari.maastokanta.mobile;
import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.html.H3;
import com.vaadin.flow.component.orderedlayout.FlexComponent;
import org.vaadin.firitin.components.orderedlayout.VHorizontalLayout;
import org.vaadin.firitin.components.orderedlayout.VVerticalLayout;
public class NavigationView extends VVerticalLayout {
private final H3 titleEl = new H3();
private final VHorizontalLayout navigationBar = new VHorizontalLayout()
.withPadding(false)
.space()
.withComponent(titleEl)
.space()
.alignAll(FlexComponent.Alignment.CENTER);
public NavigationView(String title) {
setPadding(false);
setSpacing(false);
titleEl.setText(title);
add(navigationBar);
}
public void setTitle(String title) {
titleEl.setText(title);
}
public void setLeftComponent(Component component) {
navigationBar.addComponentAsFirst(component);
}
public void setRightComponent(Component component) {
navigationBar.add(component);
}
public void setContent(Component mainContent) {
add(mainContent);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment