Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

add styles for desktop and mobile

Łukasz Adamczyka212b03c8b1f
diff --git a/frontend/app/helpers/spree/products_filters_helper.rb b/frontend/app/helpers/spree/products_filters_helper.rb
index 46308f1a96..05ec2f4d43 100644
--- a/frontend/app/helpers/spree/products_filters_helper.rb
+++ b/frontend/app/helpers/spree/products_filters_helper.rb
@@ -1,16 +1,34 @@
module Spree
module ProductsFiltersHelper
- def min_price_filter_input
- price_filter_input(name: :min_price, value: prices.first, placeholder: Spree.t(:min))
+ def min_price_filter_input(**html_options)
+ price_filter_input(
+ name: :min_price,
+ value: prices.first,
+ placeholder: "#{currency_symbol(current_currency)} #{Spree.t(:min)}",
+ **html_options
+ )
end
- def max_price_filter_input
- price_filter_input(name: :max_price, value: prices.last, placeholder: Spree.t(:max))
+ def max_price_filter_input(**html_options)
+ price_filter_input(
+ name: :max_price,
+ value: prices.last,
+ placeholder: "#{currency_symbol(current_currency)} #{Spree.t(:max)}",
+ **html_options
+ )
end
- def price_filter_input(name:, value:, placeholder:)
+ def price_filter_input(name:, value:, placeholder:, **html_options)
price_value = value&.zero? ? '' : value
- number_field_tag(name, price_value, id: name, min: 0, step: 1, placeholder: placeholder)
+ style_class = "spree-flat-input #{html_options[:class]}"
+
+ number_field_tag(
+ name, price_value,
+ id: name,
+ class: style_class,
+ min: 0, step: 1, placeholder: placeholder,
+ **html_options.except(:class)
+ )
end
private
diff --git a/frontend/app/views/spree/products/_filters_desktop.html.erb b/frontend/app/views/spree/products/_filters_desktop.html.erb
index bca23cebd8..3433ddaf9c 100644
--- a/frontend/app/views/spree/products/_filters_desktop.html.erb
+++ b/frontend/app/views/spree/products/_filters_desktop.html.erb
@@ -84,10 +84,13 @@
<% end %>
<% end %>
- <div id="filterPriceRangeDesktop">
- <%= min_price_filter_input %>
- <%= max_price_filter_input %>
- <%= link_to Spree.t('plp.done'), permitted_params, class: 'btn btn-primary spree-btn', data: { params: permitted_params } %>
+ <div id="filterPriceRangeDesktop" class="m-1">
+ <div class="d-inline-flex mb-2">
+ <%= min_price_filter_input class: 'w-50 p-2 mr-1' %>
+ <%= max_price_filter_input class: 'w-50 p-2' %>
+ </div>
+
+ <%= link_to Spree.t('plp.done'), permitted_params, class: 'btn btn-primary spree-btn w-100', data: { params: permitted_params } %>
</div>
</div>
</div>
diff --git a/frontend/app/views/spree/products/_filters_mobile.html.erb b/frontend/app/views/spree/products/_filters_mobile.html.erb
index 27b3b41898..9c3f504cac 100644
--- a/frontend/app/views/spree/products/_filters_mobile.html.erb
+++ b/frontend/app/views/spree/products/_filters_mobile.html.erb
@@ -75,9 +75,11 @@
<% end %>
<% end %>
- <div id="filterPriceRangeMobile">
- <%= min_price_filter_input %>
- <%= max_price_filter_input %>
+ <div id="filterPriceRangeMobile" class="m-1">
+ <div class="d-inline-flex">
+ <%= min_price_filter_input class: 'w-50 p-2 mr-1' %>
+ <%= max_price_filter_input class: 'w-50 p-2' %>
+ </div>
</div>
</div>
</div>