Skip to content

Commit

Permalink
feat: added backbuttons with css
Browse files Browse the repository at this point in the history
  • Loading branch information
MatheaGjerde committed Mar 30, 2026
1 parent b841bb5 commit 4535524
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@
import javafx.scene.Node;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;

public class DonationPageView extends BorderPane {
private final AppState appState;
Expand All @@ -40,13 +37,22 @@ public DonationPageView(AppState appState, NavigationController nav, DonationCon
this.nav = nav;
this.donationController = donationController;

getStylesheets().add(getClass().getResource("/donationpage/donation.css").toExternalForm());
getStylesheets().add(Objects.requireNonNull(getClass().getResource("/donationpage/donation.css")).toExternalForm());

VBox content = new VBox();
content.getChildren().addAll(createDonationGrid(), createPaymentMethodSection(), createDonateSection());
content.getChildren().addAll(createBackButton(), createDonationGrid(), createPaymentMethodSection(), createDonateSection());
setCenter(content);

}
private HBox createBackButton() {
Button backBtn = new Button("←");
backBtn.getStyleClass().add("back-button");
backBtn.setOnAction(e -> nav.showOrganizationPage());

HBox container = new HBox(backBtn);
container.setPadding(new Insets(10, 0, 0, 10));
return container;
}
private TilePane createDonationGrid(){
TilePane body = new TilePane();
body.setAlignment(Pos.CENTER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import edu.group5.app.control.NavigationController;
import edu.group5.app.model.AppState;
import edu.group5.app.model.organization.Organization;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
Expand All @@ -16,6 +17,8 @@
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;

import java.util.Objects;

public class OrganizationPageView extends BorderPane {
private final AppState appState;
private final NavigationController nav;
Expand All @@ -26,24 +29,34 @@ public OrganizationPageView(AppState appState, NavigationController nav, Donatio
this.nav = nav;
this.donationController = donationController;

getStylesheets().add(getClass().getResource("/organizationpage/organizationpage.css").toExternalForm());
setCenter(createBody());
getStylesheets().add(Objects.requireNonNull(getClass().getResource("/organizationpage/organizationpage.css")).toExternalForm());

VBox content = new VBox();
content.getChildren().addAll(createBackButton(), createBody());
setCenter(content);
}

private ScrollPane createBody() {
ScrollPane body = new ScrollPane();
body.setFitToWidth(true);
body.setFitToHeight(true)
;
body.setFitToHeight(true);

VBox vBox = new VBox();
vBox.setId("main-container");

vBox.getChildren().addAll(
createOrgSection()
);
vBox.getChildren().addAll(createOrgSection());
body.setContent(vBox);
return body;
}
private HBox createBackButton() {
Button backBtn = new Button("←");
backBtn.getStyleClass().add("back-button");
backBtn.setOnAction(e -> nav.showCausesPage());

HBox container = new HBox(backBtn);
container.setPadding(new Insets(10, 0, 0, 10));
return container;
}

private HBox createOrgSection() {
HBox orgSection = new HBox();
Expand Down
16 changes: 16 additions & 0 deletions src/main/resources/donationpage/donation.css
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,20 @@
.donation-button-selected .donation-title,
.donation-button-selected .donation-amount {
-fx-fill: white;
}
.back-button {
-fx-background-color: white;
-fx-text-fill: black;
-fx-font-weight: bold;
-fx-font-size: 20px;
-fx-background-radius: 50;
-fx-padding: 4px 10px;
-fx-cursor: hand;
-fx-border-radius: 50;
-fx-border-color: black;
-fx-border-width: 2px;
}
.back-button:hover {
-fx-background-color: #333;
-fx-border-color:#333;
}
16 changes: 16 additions & 0 deletions src/main/resources/organizationpage/organizationpage.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,20 @@

#donate-button:hover {
-fx-background-color: #c02020;
}
.back-button {
-fx-background-color: white;
-fx-text-fill: black;
-fx-font-weight: bold;
-fx-font-size: 20px;
-fx-background-radius: 50;
-fx-padding: 4px 10px;
-fx-cursor: hand;
-fx-border-radius: 50;
-fx-border-color: black;
-fx-border-width: 2px;
}
.back-button:hover {
-fx-background-color: #333;
-fx-border-color:#333;
}

0 comments on commit 4535524

Please sign in to comment.