Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Center images and set max height #153

Merged
merged 1 commit into from
Sep 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions src/lib/components/lemmy/post/Post.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,18 @@
<svelte:component
this={$userSettings.expandImages ? ExpandableImage : Empty}
url={bestImageURL(post.post, false, 2048)}
class="self-stretch max-w-full"
class="container mx-auto w-fit"
>
<svelte:element
this={$userSettings.expandImages ? 'div' : 'a'}
href={postLink(post.post)}
class="self-stretch overflow-hidden z-10 relative {loaded
class="container mx-auto z-10 relative {loaded
? ''
: 'bg-slate-200 dark:bg-zinc-800'} rounded-md max-w-full"
: 'bg-slate-200 dark:bg-zinc-800'} rounded-md w-fit max-h-[70vh]"
data-sveltekit-preload-data="off"
aria-label={post.post.name}
>
<picture
class="flex justify-center rounded-xl
overflow-hidden w-[50vh] h-auto max-w-full"
>
<picture class="max-h-[inherit]">
<source
srcset={bestImageURL(post.post, false, 512)}
media="(max-width: 256px)"
Expand All @@ -101,7 +98,7 @@
<img
src={bestImageURL(post.post, false, 1024)}
loading="lazy"
class="max-w-full w-max object-cover rounded-md max-h-[80vh] h-auto z-30 opacity-0 transition-opacity duration-300"
class="max-h-[inherit] w-auto rounded-md z-30 opacity-0 transition-opacity duration-300"
class:opacity-100={loaded}
width={512}
height={300}
Expand Down