Skip to content

Commit

Permalink
fix: avatar component and better media inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
moonlitgrace committed Jan 23, 2025
1 parent ff653cc commit ccfd1ed
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
}
}
// when changes form update forms_state
onDestroy(() => {
update_forms_state('introduction', {
name,
Expand Down Expand Up @@ -89,7 +90,7 @@
<div class="overflow-hidden rounded-2xl bg-neutral shadow-xl">
<div
class="flex h-10 bg-base-content bg-cover bg-center"
style="background-image: url({cover || ''});"
style="background-image: url({cover});"
>
<input
id="community-cover-upload"
Expand All @@ -100,16 +101,18 @@
/>
<label
for="community-cover-upload"
class="btn btn-square btn-circle btn-sm m-1 ml-auto bg-cover"
class="btn btn-square btn-circle btn-sm m-1 ml-auto border-none bg-base-300/50"
aria-label="Upload community cover"
>
<coreicons-shape-plus variant="circle" class="size-4"></coreicons-shape-plus>
<coreicons-shape-edit variant="line-with-pencil" class="size-4"></coreicons-shape-edit>
</label>
</div>
<div class="flex flex-col gap-4 p-4">
<div class="flex items-center gap-4">
<div class="group relative flex items-center justify-center">
<Avatar src={avatar || ''} class="size-14 flex-shrink-0 !bg-base-content/25" />
<div
class="group relative flex items-center justify-center overflow-hidden rounded-full"
>
<Avatar src={avatar} class="size-14 flex-shrink-0 !bg-base-content/25" />
<input
id="community-avatar-upload"
type="file"
Expand All @@ -119,10 +122,11 @@
/>
<label
for="community-avatar-upload"
class="btn btn-square btn-circle btn-sm absolute m-1 opacity-0 group-hover:opacity-100"
class="btn btn-square btn-circle btn-sm absolute m-0 translate-y-12 transform opacity-100 transition-transform duration-300 group-hover:translate-y-0 group-hover:opacity-100"
aria-label="Upload community avatar"
>
<coreicons-shape-plus variant="circle" class="size-4"></coreicons-shape-plus>
<coreicons-shape-edit variant="line-with-pencil" class="size-4"
></coreicons-shape-edit>
</label>
</div>
<div class="flex flex-col">
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/components/ui/avatar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
)}
>
{#if valid_src}
<img {src} alt="" />
<img {src} alt="" class="size-full object-cover" />
{:else}
<svg
class="w-1/2 max-w-10 text-neutral-content"
Expand Down

0 comments on commit ccfd1ed

Please sign in to comment.