Skip to content

Commit cebf50f

Browse files
committed
fix: Avatar positioning logic
1 parent b7646d2 commit cebf50f

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/lib/atoms/Avatar.svelte

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
export let avatarHash: string;
55
export let avatarDecoration: AvatarDecorationData | null;
66
export let globalName: string;
7+
export let hasBanner: boolean;
78
89
const avatarUrl =
910
avatarHash !== null
@@ -22,7 +23,7 @@
2223

2324
<div>
2425
<img
25-
class="avatar"
26+
class="avatar {hasBanner ? 'hasCustomBanner' : 'hasColorBanner'}"
2627
src={avatarUrl}
2728
alt={`${globalName}'s avatar`}
2829
draggable={false}
@@ -33,15 +34,20 @@
3334
{/if}
3435
</div>
3536

36-
<style>
37+
<style lang="scss">
3738
.avatar {
3839
border-radius: 100%;
3940
position: absolute;
4041
width: 80px;
4142
height: 80px;
42-
top: 90px;
4343
left: 22px;
4444
user-select: none;
45+
&.hasCustomBanner {
46+
top: 90px;
47+
}
48+
&.hasColorBanner {
49+
top: 16px;
50+
}
4551
}
4652
4753
.decor {

src/lib/organisms/Profile.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
avatarHash={user.user.avatar}
5454
avatarDecoration={user.user.avatar_decoration_data}
5555
globalName={user.user.global_name}
56+
hasBanner={user.user.banner !== null}
5657
/>
5758
<div class="main">
5859
<Badges

0 commit comments

Comments
 (0)