-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Changed price filter to use text input #3280
Merged
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
cfd2b07
Changed price filter to use text input
tyleralsbury c9916e2
Removed stepping and enabled all meta key inputs
tyleralsbury 7b38180
Turned price filter into a snippet to remove duplicate code
tyleralsbury 4432391
Merge branch 'main' into price-filter-changes
tyleralsbury 7f83120
Removed need for nbsp, added escape and apostrophe, slightly changed …
tyleralsbury 5466551
Merge branch 'price-filter-changes' of https://github.com/Shopify/daw…
tyleralsbury b93c7d4
Retain focus in text inputs
tyleralsbury File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -357,13 +357,6 @@ | |
</div> | ||
</details> | ||
{% when 'price_range' %} | ||
{% liquid | ||
assign currencies_using_comma_decimals = 'ANG,ARS,BRL,BYN,BYR,CLF,CLP,COP,CRC,CZK,DKK,EUR,HRK,HUF,IDR,ISK,MZN,NOK,PLN,RON,RUB,SEK,UYU,VES,VND' | split: ',' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A weight off my shoulders for this to be gone. 😄 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was literally thinking "How did currencies become the new payment logos!?" |
||
assign uses_comma_decimals = false | ||
if currencies_using_comma_decimals contains cart.currency.iso_code | ||
assign uses_comma_decimals = true | ||
endif | ||
%} | ||
<details | ||
id="Details-{{ filter.param_name | escape }}-{{ section.id }}" | ||
class="{% if filter_type == 'horizontal' %}disclosure-has-popup facets__disclosure{% else %} facets__disclosure-vertical{% endif %} js-filter" | ||
|
@@ -396,61 +389,7 @@ | |
{%- endif -%} | ||
</div> | ||
<price-range class="facets__price"> | ||
<span class="field-currency">{{ cart.currency.symbol }}</span> | ||
<div class="field"> | ||
<input | ||
class="field__input" | ||
name="{{ filter.min_value.param_name }}" | ||
id="Filter-{{ filter.label | escape }}-GTE" | ||
{%- if filter.min_value.value -%} | ||
{%- if uses_comma_decimals -%} | ||
value="{{ filter.min_value.value | money_without_currency | replace: '.', '' | replace: ',', '.' }}" | ||
{%- else -%} | ||
value="{{ filter.min_value.value | money_without_currency | replace: ',', '' }}" | ||
{%- endif %} | ||
{%- endif -%} | ||
type="number" | ||
placeholder="0" | ||
min="0" | ||
{%- if uses_comma_decimals -%} | ||
max="{{ filter.range_max | money_without_currency | replace: '.', '' | replace: ',', '.' }}" | ||
{%- else -%} | ||
max="{{ filter.range_max | money_without_currency | replace: ',', '' }}" | ||
{% endif %} | ||
> | ||
<label class="field__label" for="Filter-{{ filter.label | escape }}-GTE"> | ||
{{- 'products.facets.from' | t -}} | ||
</label> | ||
</div> | ||
{%- if filter_type != 'vertical' -%} | ||
<span class="field-currency">{{ cart.currency.symbol }}</span> | ||
{%- endif -%} | ||
<div class="field"> | ||
<input | ||
class="field__input" | ||
name="{{ filter.max_value.param_name }}" | ||
id="Filter-{{ filter.label | escape }}-LTE" | ||
{%- if filter.max_value.value -%} | ||
{%- if uses_comma_decimals -%} | ||
value="{{ filter.max_value.value | money_without_currency | replace: '.', '' | replace: ',', '.' }}" | ||
{%- else -%} | ||
value="{{ filter.max_value.value | money_without_currency | replace: ',', '' }}" | ||
{%- endif %} | ||
{%- endif -%} | ||
type="number" | ||
min="0" | ||
{%- if uses_comma_decimals -%} | ||
placeholder="{{ filter.range_max | money_without_currency | replace: '.', '' | replace: ',', '.' }}" | ||
max="{{ filter.range_max | money_without_currency | replace: '.', '' | replace: ',', '.' }}" | ||
{%- else -%} | ||
placeholder="{{ filter.range_max | money_without_currency | replace: ',', '' }}" | ||
max="{{ filter.range_max | money_without_currency | replace: ',', '' }}" | ||
{% endif %} | ||
> | ||
<label class="field__label" for="Filter-{{ filter.label | escape }}-LTE"> | ||
{{- 'products.facets.to' | t -}} | ||
</label> | ||
</div> | ||
{% render 'price-facet', filter: filter, id_prefix: 'Filter-', filter_type: filter_type %} | ||
</price-range> | ||
</div> | ||
</details> | ||
|
@@ -487,7 +426,7 @@ | |
{%- else -%} | ||
{{ 0 | money }} | ||
{%- endif -%} | ||
- | ||
- | ||
tyleralsbury marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{%- if filter.max_value.value -%} | ||
{{ filter.max_value.value | money }} | ||
{%- else -%} | ||
|
@@ -840,13 +779,6 @@ | |
</div> | ||
</details> | ||
{% when 'price_range' %} | ||
{% liquid | ||
assign currencies_using_comma_decimals = 'ANG,ARS,BRL,BYN,BYR,CLF,CLP,COP,CRC,CZK,DKK,EUR,HRK,HUF,IDR,ISK,MZN,NOK,PLN,RON,RUB,SEK,UYU,VES,VND' | split: ',' | ||
assign uses_comma_decimals = false | ||
if currencies_using_comma_decimals contains cart.currency.iso_code | ||
assign uses_comma_decimals = true | ||
endif | ||
%} | ||
<details | ||
id="Details-Mobile-{{ filter.param_name | escape }}-{{ section.id }}" | ||
class="mobile-facets__details js-filter" | ||
|
@@ -878,62 +810,7 @@ | |
</p> | ||
|
||
<price-range class="facets__price"> | ||
<span class="field-currency">{{ cart.currency.symbol }}</span> | ||
<div class="field"> | ||
<input | ||
class="field__input" | ||
name="{{ filter.min_value.param_name }}" | ||
id="Mobile-Filter-{{ filter.label | escape }}-GTE" | ||
{%- if filter.min_value.value -%} | ||
{%- if uses_comma_decimals -%} | ||
value="{{ filter.min_value.value | money_without_currency | replace: '.', '' | replace: ',', '.' }}" | ||
{%- else -%} | ||
value="{{ filter.min_value.value | money_without_currency | replace: ',', '' }}" | ||
{%- endif %} | ||
{%- endif -%} | ||
type="number" | ||
placeholder="0" | ||
min="0" | ||
inputmode="decimal" | ||
{%- if uses_comma_decimals -%} | ||
max="{{ filter.range_max | money_without_currency | replace: '.', '' | replace: ',', '.' }}" | ||
{%- else -%} | ||
max="{{ filter.range_max | money_without_currency | replace: ',', '' }}" | ||
{% endif %} | ||
> | ||
<label class="field__label" for="Mobile-Filter-{{ filter.label | escape }}-GTE"> | ||
{{- 'products.facets.from' | t -}} | ||
</label> | ||
</div> | ||
|
||
<span class="field-currency">{{ cart.currency.symbol }}</span> | ||
<div class="field"> | ||
<input | ||
class="field__input" | ||
name="{{ filter.max_value.param_name }}" | ||
id="Mobile-Filter-{{ filter.label | escape }}-LTE" | ||
{%- if filter.max_value.value -%} | ||
{%- if uses_comma_decimals -%} | ||
value="{{ filter.max_value.value | money_without_currency | replace: '.', '' | replace: ',', '.' }}" | ||
{%- else -%} | ||
value="{{ filter.max_value.value | money_without_currency | replace: ',', '' }}" | ||
{%- endif %} | ||
{%- endif -%} | ||
type="number" | ||
min="0" | ||
inputmode="decimal" | ||
{%- if uses_comma_decimals -%} | ||
placeholder="{{ filter.range_max | money_without_currency | replace: '.', '' | replace: ',', '.' }}" | ||
max="{{ filter.range_max | money_without_currency | replace: '.', '' | replace: ',', '.' }}" | ||
{%- else -%} | ||
placeholder="{{ filter.range_max | money_without_currency | replace: ',', '' }}" | ||
max="{{ filter.range_max | money_without_currency | replace: ',', '' }}" | ||
{% endif %} | ||
> | ||
<label class="field__label" for="Mobile-Filter-{{ filter.label | escape }}-LTE"> | ||
{{- 'products.facets.to' | t -}} | ||
</label> | ||
</div> | ||
{% render 'price-facet', filter: filter, id_prefix: 'Mobile-Filter-' %} | ||
</price-range> | ||
<div class="no-js-hidden mobile-facets__footer"> | ||
<facet-remove class="mobile-facets__clear-wrapper"> | ||
|
@@ -1051,7 +928,7 @@ | |
{%- else -%} | ||
{{ 0 | money }} | ||
{%- endif -%} | ||
- | ||
- | ||
{%- if filter.max_value.value -%} | ||
{{ filter.max_value.value | money }} | ||
{%- else -%} | ||
tyleralsbury marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
@@ -1168,7 +1045,7 @@ | |
{%- else -%} | ||
{{ 0 | money }} | ||
{%- endif -%} | ||
- | ||
- | ||
tyleralsbury marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{%- if filter.max_value.value -%} | ||
{{ filter.max_value.value | money }} | ||
{%- else -%} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<span class="field-currency">{{ cart.currency.symbol }}</span> | ||
|
||
<div class="field"> | ||
<input | ||
class="field__input" | ||
name="{{ filter.min_value.param_name }}" | ||
id="{{ id_prefix }}{{ filter.label | escape }}-GTE" | ||
{%- if filter.min_value.value -%} | ||
value="{{ filter.min_value.value | money_without_currency }}" | ||
{%- endif -%} | ||
type="text" | ||
inputmode="decimal" | ||
placeholder="0" | ||
data-pattern="\d| |,|\." | ||
data-min="0" | ||
data-max="{{ filter.range_max | money_without_currency }}" | ||
> | ||
<label class="field__label" for="{{ id_prefix }}{{ filter.label | escape }}-GTE"> | ||
{{- 'products.facets.from' | t -}} | ||
</label> | ||
</div> | ||
|
||
{%- if filter_type != 'vertical' -%} | ||
<span class="field-currency">{{ cart.currency.symbol }}</span> | ||
{%- endif -%} | ||
|
||
<div class="field"> | ||
<input | ||
class="field__input" | ||
name="{{ filter.max_value.param_name }}" | ||
id="{{ id_prefix }}{{ filter.label | escape }}-LTE" | ||
{%- if filter.max_value.value -%} | ||
value="{{ filter.max_value.value | money_without_currency }}" | ||
{%- endif -%} | ||
type="text" | ||
inputmode="decimal" | ||
placeholder="{{ filter.range_max | money_without_currency }}" | ||
data-pattern="\d| |,|\." | ||
data-min="0" | ||
data-max="{{ filter.range_max | money_without_currency }}" | ||
> | ||
<label class="field__label" for="{{ id_prefix }}{{ filter.label | escape }}-LTE"> | ||
{{- 'products.facets.to' | t -}} | ||
</label> | ||
</div> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this is a full list of keys that matter. Should be tested for completeness.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should add apostrophe
'
, it's one of the supported currency formats https://help.shopify.com/en/manual/markets/pricing/currency-formattingThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting that I was able to press
Esc
without issue even thoughEscape
is it's own value. 🤔 MDN link. I wonder if some other event listener on the modal caught this, and the event was allowed to propagate up. Regardless, worth addingEscape
to the list.