Skip to content

Commit

Permalink
feat: created HomePageView
Browse files Browse the repository at this point in the history
  • Loading branch information
emilfa committed Mar 10, 2026
1 parent 6bf7ee7 commit df5a249
Showing 1 changed file with 57 additions and 1 deletion.
58 changes: 57 additions & 1 deletion src/main/java/edu/group5/app/view/homepage/HomePageView.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,68 @@
package edu.group5.app.view.homepage;

import edu.group5.app.control.HeaderController;
import edu.group5.app.control.HomePageController;
import edu.group5.app.view.Header;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.control.ScrollPane;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;

public class HomePageView extends BorderPane {
public HomePageView(HeaderController headerController) {
private final HomePageController controller;

public HomePageView(HomePageController homePageController, HeaderController headerController) {
this.controller = homePageController;
getStylesheets().add(getClass().getResource("/homepage/homepage.css").toExternalForm());
Header headerView = new Header(headerController);
setTop(headerView);
setCenter(createBody());
}

private ScrollPane createBody() {
ScrollPane body = new ScrollPane();
body.setFitToWidth(true);
VBox vBox = new VBox();
vBox.getChildren().addAll(
createIntroductionSection(),
createCharityImageSection(),
createCharityImageSection()
);
body.setContent(vBox);
return body;
}

private VBox createIntroductionSection() {
VBox introductionSection = new VBox();
introductionSection.setId("introduction-section");
introductionSection.setAlignment(Pos.CENTER);
introductionSection.setSpacing(10);

Text h1 = new Text("MAKE A DIFFERENCE TODAY");
h1.setId("h1");
Text h2 = new Text("SUPPORT THOSE IN NEED AROUND THE WORLD");
h2.setId("h2");

Button donateToACauseBtn = new Button("Donate to a cause");
donateToACauseBtn.setOnAction(e -> controller.handleDonateToACauseBtn());

Button aboutUsBtn = new Button("About us");
aboutUsBtn.setOnAction(e -> controller.handleAboutUsBtn());

introductionSection.getChildren().addAll(h1, h2, donateToACauseBtn, aboutUsBtn);
return introductionSection;
}

private StackPane createCharityImageSection() {
StackPane charityImageSection = new StackPane();
charityImageSection.setId("charity-image-section");
charityImageSection.setPrefHeight(300);
StackPane image = new StackPane();
image.setId("charity-image");
charityImageSection.getChildren().add(image);
return charityImageSection;
}
}

0 comments on commit df5a249

Please sign in to comment.