posts: increase default thumbnail size.

* Increase the default thumbnail size from small (150x150) to medium (180x180).
* Change the mobile layout to use three posts per row instead of two for small thumbnails.

Parent/child posts are still 150x150 to avoid taking up even more space above posts.
This commit is contained in:
evazion
2021-12-13 03:22:57 -06:00
parent e04892fb38
commit 0997f5595e
7 changed files with 22 additions and 16 deletions

View File

@@ -7,6 +7,10 @@
# seen in parent/child post sets.
#
class PostGalleryComponent < ApplicationComponent
# The default size of thumbnails in a gallery. See also PostPreviewComponent::DEFAULT_SIZE
# for the default size of standalone thumbnails.
DEFAULT_SIZE = "180"
attr_reader :inline, :size, :options
# The list of posts in the gallery.
@@ -20,7 +24,7 @@ class PostGalleryComponent < ApplicationComponent
# @param size [String] The size of thumbnails in the gallery. Can be "150",
# "180", "225", "225w", "270", "270w", or "360".
# @param options [Hash] A set of options given to the PostPreviewComponent.
def initialize(inline: false, size: PostPreviewComponent::DEFAULT_SIZE, **options)
def initialize(inline: false, size: DEFAULT_SIZE, **options)
super
@inline = inline
@options = options
@@ -28,7 +32,7 @@ class PostGalleryComponent < ApplicationComponent
if size.to_s.in?(PostPreviewComponent::SIZES)
@size = size
else
@size = PostPreviewComponent::DEFAULT_SIZE
@size = DEFAULT_SIZE
end
end

View File

@@ -43,7 +43,7 @@
gap: 0.25rem;
}
&.post-gallery-150 .posts-container { grid-template-columns: repeat(2, auto); }
&.post-gallery-150 .posts-container { grid-template-columns: repeat(3, minmax(0, 150px)); }
&.post-gallery-180 .posts-container { grid-template-columns: repeat(2, auto); }
&.post-gallery-225 .posts-container { grid-template-columns: repeat(2, auto); }
&.post-gallery-225w .posts-container { grid-template-columns: repeat(2, auto); }

View File

@@ -1,7 +1,9 @@
# frozen_string_literal: true
class PostPreviewComponent < ApplicationComponent
DEFAULT_SIZE = "150"
# The default size of standalone thumbnails not in a gallery. See also
# PostGalleryComponent::DEFAULT_SIZE for the default size of thumbnails in a gallery.
DEFAULT_SIZE = "180"
SIZES = %w[150 180 225 225w 270 270w 360]