fix: sidebar profile layout

This commit is contained in:
Zamitto 2024-08-26 13:21:21 -03:00
parent 9e02504e14
commit 3293320926
2 changed files with 20 additions and 27 deletions

View file

@ -7,22 +7,24 @@ export const profileContainerBackground = createVar();
export const profileContainer = style({ export const profileContainer = style({
background: profileContainerBackground, background: profileContainerBackground,
position: "relative", position: "relative",
display: "flex",
gap: `${SPACING_UNIT}px`,
cursor: "pointer", cursor: "pointer",
":hover": { ":hover": {
backgroundColor: "rgba(255, 255, 255, 0.15)", backgroundColor: "rgba(255, 255, 255, 0.15)",
}, },
borderBottom: `solid 1px ${vars.color.border}`,
boxShadow: "0px 0px 15px 0px rgb(0 0 0 / 70%)",
padding: `${SPACING_UNIT * 2}px ${SPACING_UNIT * 2}px`,
}); });
export const profileButton = style({ export const profileButton = style({
display: "flex", display: "flex",
cursor: "pointer", cursor: "pointer",
transition: "all ease 0.1s", transition: "all ease 0.1s",
padding: `${SPACING_UNIT * 2}px ${SPACING_UNIT * 2}px`,
color: vars.color.muted, color: vars.color.muted,
borderBottom: `solid 1px ${vars.color.border}`,
boxShadow: "0px 0px 15px 0px rgb(0 0 0 / 70%)",
width: "100%", width: "100%",
zIndex: "10", overflow: "hidden",
}); });
export const profileButtonContent = style({ export const profileButtonContent = style({
@ -75,16 +77,6 @@ export const profileButtonTitle = style({
whiteSpace: "nowrap", whiteSpace: "nowrap",
}); });
export const friendRequestContainer = style({
position: "absolute",
padding: "8px",
right: `${SPACING_UNIT}px`,
display: "flex",
top: 0,
bottom: 0,
alignItems: "center",
});
export const friendRequestButton = style({ export const friendRequestButton = style({
color: vars.color.success, color: vars.color.success,
cursor: "pointer", cursor: "pointer",

View file

@ -41,6 +41,9 @@ export function SidebarProfile() {
return undefined; return undefined;
}, [profileBackground]); }, [profileBackground]);
const showPendingRequests =
userDetails && receivedRequests.length > -1 && !gameRunning;
return ( return (
<div <div
className={styles.profileContainer} className={styles.profileContainer}
@ -88,8 +91,7 @@ export function SidebarProfile() {
)} )}
</div> </div>
</button> </button>
{userDetails && receivedRequests.length > 0 && !gameRunning && ( {showPendingRequests && (
<div className={styles.friendRequestContainer}>
<button <button
type="button" type="button"
className={styles.friendRequestButton} className={styles.friendRequestButton}
@ -100,7 +102,6 @@ export function SidebarProfile() {
<PersonAddIcon size={24} /> <PersonAddIcon size={24} />
{receivedRequests.length} {receivedRequests.length}
</button> </button>
</div>
)} )}
</div> </div>
); );