Support medium-sized profile pictures

This commit is contained in:
Andreas Svanberg 2023-12-05 13:45:16 +01:00
parent 5f298b3828
commit a615f12238
2 changed files with 11 additions and 9 deletions
view/src/main
java/se/su/dsv/scipro/profile
webapp/css

@ -9,7 +9,7 @@ import se.su.dsv.scipro.system.User;
public class UserProfileImage extends WebComponent {
public enum Size {
TINY(16), LARGE(128);
TINY(16), MEDIUM(64), LARGE(128);
private final int pixels;
@ -36,14 +36,12 @@ public class UserProfileImage extends WebComponent {
checkComponentTag(tag, "img");
super.onComponentTag(tag);
tag.put("src", getImageSrc());
switch (size) {
case TINY:
tag.append("class", "profile-picture-sm", " ");
break;
case LARGE:
tag.append("class", "profile-picture-lg", " ");
break;
}
String cssClass = switch (size) {
case TINY -> "profile-picture-sm";
case MEDIUM -> "profile-picture-md";
case LARGE -> "profile-picture-lg";
};
tag.append("class", cssClass, " ");
tag.put("alt", "photo");
tag.put("loading", "lazy");
}

@ -527,6 +527,10 @@ th.wicket_orderUp, th.sorting_asc {
max-width: 16px;
max-height: 16px;
}
.profile-picture-md {
max-width: 64px;
max-height: 64px;
}
.profile-picture-lg {
max-width: 128px;
max-height: 128px;