Skip to content

Commit dd5aceb

Browse files
SteffengreinerKochTobisven1103
authored
Show the University Tübingen Logo (#601)
* Refactor Login UI with title and background image * Provide fields as final * Remove background image --------- Co-authored-by: Tobias Koch <[email protected]> Co-authored-by: Sven F <[email protected]>
1 parent 0a4162d commit dd5aceb

File tree

8 files changed

+690
-12
lines changed

8 files changed

+690
-12
lines changed

user-interface/frontend/themes/datamanager/components/main.css

+36-2
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,52 @@
11
#content-area {
2-
overflow: auto;
32
grid-area: content-area;
43
}
54

65
#main-layout {
76
display: grid;
87
grid-template-columns: 1fr;
9-
grid-template-rows: 1fr;
8+
grid-template-rows: minmax(max-content, 95%) minmax(min-content, 5%);
109
height: 100%;
1110
grid-template-areas:
1211
"content-area"
1312
"data-manager-footer";
1413
}
1514

15+
#landing-page-layout .landing-page-content {
16+
/*Static resources have to be loaded in css form the Meta-INF directory see vaadin cheatsheet
17+
https://vaadin.com/vaadin-reference-card#static-content */
18+
/*Provide Background image here once a valid one is provided*/
19+
background-size: cover;
20+
background-position: center;
21+
background-repeat: no-repeat;
22+
height: 100%;
23+
}
24+
25+
#landing-page-layout .landing-page-title-and-logo {
26+
display: flex;
27+
align-items: center;
28+
justify-content: center;
29+
flex-direction: column;
30+
row-gap: var(--lumo-space-s);
31+
margin-bottom: var(--lumo-space-l);
32+
padding-top: var(--lumo-space-xl);
33+
}
34+
35+
#landing-page-layout .landing-page-title-and-logo .title {
36+
font-weight: bold;
37+
font-size: var(--lumo-font-size-xxl);
38+
}
39+
40+
#landing-page-layout .landing-page-title-and-logo .subtitle {
41+
color: var(--lumo-tertiary-text-color);
42+
font-weight: bold;
43+
}
44+
45+
#landing-page-layout .landing-page-title-and-logo .ut-logo {
46+
height: 2.5em;
47+
margin-bottom: var(--lumo-space-xl);
48+
}
49+
1650
#data-manager-footer {
1751
display: inline-flex;
1852
column-gap: var(--lumo-space-l);

user-interface/frontend/themes/datamanager/components/navbar.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
width: 100%;
8888
}
8989

90-
.landing-page-layout::part(navbar) {
90+
#landing-page-layout::part(navbar) {
9191
padding-inline: var(--lumo-space-m);
9292
}
9393

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package life.qbic.datamanager.views;
2+
3+
import com.vaadin.flow.component.html.Div;
4+
import com.vaadin.flow.component.html.Image;
5+
import com.vaadin.flow.component.html.Span;
6+
import com.vaadin.flow.server.StreamResource;
7+
8+
/**
9+
* Landing Page Title and Logo
10+
* <p>
11+
* {@link Div} based Component hosting the university Tübingen Logo and the Title to be shown in all
12+
* Pages that have the {@link life.qbic.datamanager.views.landing.LandingPageLayout} as their parent
13+
* layout.
14+
*/
15+
public class LandingPageTitleAndLogo extends Div {
16+
17+
private final Span title = new Span("Data Manager");
18+
private final Span subTitle = new Span("University of Tübingen Life Science Data Management");
19+
private final static String UT_LOGO_PATH = "login/university-tuebingen-logo.svg";
20+
21+
public LandingPageTitleAndLogo() {
22+
add(getUTLogo());
23+
addClassName("landing-page-title-and-logo");
24+
add(title);
25+
title.addClassName("title");
26+
add(subTitle);
27+
subTitle.addClassName("subtitle");
28+
}
29+
30+
private Image getUTLogo() {
31+
StreamResource utResource = new StreamResource("university_tuebingen_logo.svg",
32+
() -> getClass().getClassLoader().getResourceAsStream(UT_LOGO_PATH));
33+
Image utLogo = new Image(utResource, "university_tuebingen_logo");
34+
utLogo.addClassName("ut-logo");
35+
return utLogo;
36+
}
37+
}

user-interface/src/main/java/life/qbic/datamanager/views/landing/LandingPageLayout.java

+26-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
package life.qbic.datamanager.views.landing;
22

3+
import com.vaadin.flow.component.Component;
4+
import com.vaadin.flow.component.HasElement;
35
import com.vaadin.flow.component.button.Button;
46
import com.vaadin.flow.component.button.ButtonVariant;
7+
import com.vaadin.flow.component.html.Div;
58
import com.vaadin.flow.component.html.Span;
69
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
710
import com.vaadin.flow.router.PageTitle;
11+
import com.vaadin.flow.router.RouterLayout;
812
import java.io.Serial;
913
import java.util.Objects;
1014
import life.qbic.datamanager.views.DataManagerLayout;
15+
import life.qbic.datamanager.views.LandingPageTitleAndLogo;
1116
import org.springframework.beans.factory.annotation.Autowired;
1217

1318
/**
@@ -16,21 +21,22 @@
1621
* @since 1.0.0
1722
*/
1823
@PageTitle("Data Manager")
19-
public class LandingPageLayout extends DataManagerLayout {
24+
public class LandingPageLayout extends DataManagerLayout implements RouterLayout {
2025

2126
@Serial
2227
private static final long serialVersionUID = 8899881833038660866L;
23-
2428
public Button register;
2529
public Button login;
30+
private final Div landingPageContent = new Div();
31+
private final LandingPageTitleAndLogo landingPageTitleAndLogo = new LandingPageTitleAndLogo();
2632

2733
public LandingPageLayout(@Autowired LandingPageHandlerInterface handlerInterface) {
2834
Objects.requireNonNull(handlerInterface);
29-
addClassName("landing-page-layout");
30-
35+
setId("landing-page-layout");
36+
//CSS class hosting the background image for all our landing pages
37+
landingPageContent.addClassName("landing-page-content");
3138
createNavBarContent();
3239
registerToHandler(handlerInterface);
33-
3440
}
3541

3642
private void registerToHandler(LandingPageHandlerInterface handler) {
@@ -58,4 +64,19 @@ private HorizontalLayout createHeaderButtonLayout() {
5864
private void styleHeaderButtons() {
5965
login.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
6066
}
67+
68+
/**
69+
* {@inheritDoc}
70+
*
71+
* @param content
72+
* @throws IllegalArgumentException if content is not a {@link Component}
73+
*/
74+
@Override
75+
public void showRouterLayoutContent(HasElement content) {
76+
landingPageContent.removeAll();
77+
//Ensures that the data manager title und UT Logo is always present in this layout
78+
landingPageContent.getElement().appendChild(landingPageTitleAndLogo.getElement());
79+
landingPageContent.getElement().appendChild(content.getElement());
80+
super.showRouterLayoutContent(landingPageContent);
81+
}
6182
}

user-interface/src/main/java/life/qbic/datamanager/views/login/LoginLayout.java

-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ public class LoginLayout extends VerticalLayout implements HasUrlParameter<Strin
4444
private final transient LoginHandlerInterface viewHandler;
4545

4646
public LoginLayout(@Autowired LoginHandlerInterface loginHandlerInterface) {
47-
this.addClassName("grid");
4847
initLayout();
4948
styleLayout();
5049
viewHandler = loginHandlerInterface;
@@ -68,7 +67,6 @@ private void registerToHandler(LoginHandlerInterface loginHandler) {
6867
private void styleLayout() {
6968
styleNotificationLayout();
7069
styleFormLayout();
71-
setSizeFull();
7270
setAlignItems(FlexComponent.Alignment.CENTER);
7371
setJustifyContentMode(FlexComponent.JustifyContentMode.CENTER);
7472
}

user-interface/src/main/java/life/qbic/datamanager/views/login/passwordreset/ResetPasswordLayout.java

-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ private void styleLayout() {
7878

7979
styleFieldLayout();
8080
styleSendButton();
81-
setSizeFull();
8281
setAlignItems(FlexComponent.Alignment.CENTER);
8382
setJustifyContentMode(FlexComponent.JustifyContentMode.CENTER);
8483
}

user-interface/src/main/java/life/qbic/datamanager/views/register/UserRegistrationLayout.java

-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ private void styleLayout() {
8585
styleNotificationLayout();
8686
styleRegisterButton();
8787
styleFormLayout();
88-
setSizeFull();
8988
setAlignItems(FlexComponent.Alignment.CENTER);
9089
setJustifyContentMode(FlexComponent.JustifyContentMode.CENTER);
9190
}

0 commit comments

Comments
 (0)