diff --git a/app/furniture/marketplace/product_component.html.erb b/app/furniture/marketplace/product_component.html.erb index 1e8a5df1d..08a966de5 100644 --- a/app/furniture/marketplace/product_component.html.erb +++ b/app/furniture/marketplace/product_component.html.erb @@ -1,17 +1,20 @@ <%= render CardComponent.new(dom_id: dom_id(product)) do |card| %> - <%- card.with_header do %> -

<%= name %>

- <%- if product.archived? %> - (archived) - <%- end %> + <%- card.with_header(variant: :no_padding) do %> + <% if product.photo.present? %> +
+ <%= image_tag hero_image, class: "rounded-t-lg w-full" %> +
+

<%= name %>

+ <%- if product.archived? %> + (archived) + <%- end %> +
+
+ <%- else %> +

<%= name %>

+ <% end %> <%- end %> - - <% if product.photo.present? %> -
- <%= image_tag product.photo.variant(resize_to_limit: [150, 150]) %> -
- <% end %>
<%= description %>
@@ -23,7 +26,6 @@

<%= price %>

- <%- card.with_footer(variant: :action_bar) do %> <%= render edit_button if edit_button? %> <%= render archive_button if archive_button? %> diff --git a/app/furniture/marketplace/product_component.rb b/app/furniture/marketplace/product_component.rb index f9e84b0ac..fe3385c50 100644 --- a/app/furniture/marketplace/product_component.rb +++ b/app/furniture/marketplace/product_component.rb @@ -13,6 +13,14 @@ def edit_button super(title: t("marketplace.products.edit.link_to", name: name), href: location(:edit)) end + # 16:9 of 1290 is 1290:725.625 + # We rounded up. + # @see https://www.ios-resolution.com/ + FULL_WIDTH_16_BY_9 = [1290, 726] + def hero_image + product.photo.variant(resize_to_limit: FULL_WIDTH_16_BY_9) + end + def tax_rates product.tax_rates.map do |tax_rate| "#{tax_rate.label} #{helpers.number_to_percentage(tax_rate.tax_rate, precision: 2)}" diff --git a/spec/furniture/marketplace/selling_products_system_spec.rb b/spec/furniture/marketplace/selling_products_system_spec.rb index 7fb567b4c..c78cc761d 100644 --- a/spec/furniture/marketplace/selling_products_system_spec.rb +++ b/spec/furniture/marketplace/selling_products_system_spec.rb @@ -45,7 +45,6 @@ end click_button(I18n.t("restore.link_to")) - expect(page).to have_content(product.name) expect(product.reload).not_to be_archived end