Skip to content

Commit

Permalink
ProfilePage: Painting Buttons (#998)
Browse files Browse the repository at this point in the history
Signed-off-by: Aleksandr Muravja <[email protected]>
  • Loading branch information
Aleksandr Muravja committed Jan 31, 2023
1 parent f0fccac commit 677a7cb
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.vaadin.flow.component.ClickEvent;
import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.button.ButtonVariant;
import com.vaadin.flow.component.notification.Notification;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
Expand Down Expand Up @@ -39,12 +40,12 @@ private Component deleteAccountSectionContent() {
deleteAccountSection.getTitle().addClassName("red");
deleteAccountSection.getTitle().addClassName("bold");

Button deleteAccountOnlyButton = new Button();
deleteAccountOnlyButton.setText("Delete Account");
Button deleteAccountOnlyButton = new Button("Delete Account");
deleteAccountOnlyButton.addThemeVariants(ButtonVariant.LUMO_ERROR);
deleteAccountOnlyButton.addClickListener(this::onDeleteAccount);

Button deleteAccountAndLinksButton = new Button();
deleteAccountAndLinksButton.setText("Delete Account and Links");
Button deleteAccountAndLinksButton = new Button("Delete Account and Links");
deleteAccountAndLinksButton.addThemeVariants(ButtonVariant.LUMO_ERROR);
deleteAccountAndLinksButton.addClickListener(this::onDeleteAccountAndLinks);

HorizontalLayout layout = new HorizontalLayout(deleteAccountOnlyButton, deleteAccountAndLinksButton);
Expand Down
10 changes: 8 additions & 2 deletions src/main/java/pm/axe/ui/pages/user/profile/tabs/ProfileTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.vaadin.flow.component.ClickEvent;
import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.button.ButtonVariant;
import com.vaadin.flow.component.details.Details;
import com.vaadin.flow.component.html.Span;
import com.vaadin.flow.component.icon.VaadinIcon;
Expand Down Expand Up @@ -76,7 +77,9 @@ private HorizontalLayout createUsernameLayout() {
usernameField.setReadOnly(true);

editUsernameButton.setText("Edit");
editUsernameButton.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
saveUsernameButton.setText("Save");
saveUsernameButton.addThemeVariants(ButtonVariant.LUMO_SUCCESS, ButtonVariant.LUMO_PRIMARY);

usernameLayout.add(usernameField, editUsernameButton);
VaadinUtils.fitLayoutInWindow(usernameLayout);
Expand All @@ -94,7 +97,9 @@ private Component createEmailLayout() {
currentEmail.ifPresent(e -> emailField.setValue(currentEmail.get()));

editEmailButton.setText("Edit");
editEmailButton.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
saveEmailButton.setText("Save");
saveEmailButton.addThemeVariants(ButtonVariant.LUMO_SUCCESS, ButtonVariant.LUMO_PRIMARY);

emailLayout.add(emailField, editEmailButton);
VaadinUtils.fitLayoutInWindow(emailLayout);
Expand All @@ -118,8 +123,9 @@ private HorizontalLayout createTelegramLayout() {
telegramField.setReadOnly(true);
telegramField.setPrefixComponent(VaadinIcon.AT.create());
telegramField.setValue(telegramUsername.get());
Button unlink = new Button("Unlink");
telegramLayout.add(telegramField, unlink);
Button unlinkButton = new Button("Unlink");
unlinkButton.addThemeVariants(ButtonVariant.LUMO_ERROR);
telegramLayout.add(telegramField, unlinkButton);
} else {
telegramLayout.setVisible(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.vaadin.flow.component.AbstractField;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.button.ButtonVariant;
import com.vaadin.flow.component.checkbox.Checkbox;
import com.vaadin.flow.component.html.Anchor;
import com.vaadin.flow.component.html.Label;
Expand Down Expand Up @@ -83,6 +84,7 @@ private VerticalLayout createChangePasswordContent() {
passwordGenerator.setOpened(false);
passwordGenerator.setCopyTarget(newPasswordInput);
Button updatePasswordButton = new Button("Update");
updatePasswordButton.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
VerticalLayout changePasswordLayout = new VerticalLayout(oldPasswordInput, newPasswordInput,
passwordGenerator, updatePasswordButton);
changePasswordLayout.setPadding(false);
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/pm/axe/ui/pages/user/profile/tabs/SettingsTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.vaadin.flow.component.ClickEvent;
import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.button.ButtonVariant;
import com.vaadin.flow.component.html.Span;
import com.vaadin.flow.component.notification.Notification;
import com.vaadin.flow.component.orderedlayout.FlexLayout;
Expand Down Expand Up @@ -66,11 +67,12 @@ private Component loginSessionDuration() {
VaadinUtils.setFlex(pdField, "1 1 auto");
axeSessionUtils.getCurrentUserSettings().ifPresent(us -> pdField.setValue(us.getLoginSessionDuration()));

Button save = new Button("Save");
VaadinUtils.setFlex(save, "1");
save.addClickListener(this::onSessionDurationSaved);
Button saveButton = new Button("Save");
saveButton.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
saveButton.addClickListener(this::onSessionDurationSaved);
VaadinUtils.setFlex(saveButton, "1");

HorizontalLayout fields = new HorizontalLayout(pdField, save);
HorizontalLayout fields = new HorizontalLayout(pdField, saveButton);
VaadinUtils.setWrap(fields);
VaadinUtils.setSmallSpacing(fields);

Expand Down

0 comments on commit 677a7cb

Please sign in to comment.