Skip to content

Commit

Permalink
Add Extra Small thumbnail component.
Browse files Browse the repository at this point in the history
  • Loading branch information
jayelkaake committed Jan 28, 2025
1 parent 27664d0 commit 65018b9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/components/polaris/thumbnail_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class ThumbnailComponent < Polaris::Component

SIZE_DEFAULT = :medium
SIZE_MAPPINGS = {
extra_small: "Polaris-Thumbnail--sizeExtraSmall",
small: "Polaris-Thumbnail--sizeSmall",
medium: "Polaris-Thumbnail--sizeMedium",
large: "Polaris-Thumbnail--sizeLarge"
Expand All @@ -30,6 +31,8 @@ def initialize(
@source = source
@transparent = transparent

@size = :extra_small if [:xsmall, :x_small, :xs].include?(@size)

@system_arguments = system_arguments
end

Expand Down
3 changes: 3 additions & 0 deletions demo/app/previews/thumbnail_component_preview.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ class ThumbnailComponentPreview < ViewComponent::Preview
def default
end

def extra_small
end

def small
end

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<%= polaris_thumbnail(
source: "https://burst.shopifycdn.com/photos/black-leather-choker-necklace_373x@2x.jpg",
alt: "Black choker necklace",
size: :extra_small,
) %>

0 comments on commit 65018b9

Please # to comment.