Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Price Filter Block Design update #6877

Merged
merged 36 commits into from
Aug 16, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
c34eb7a
make toggle control full width
dinhtungdu Aug 9, 2022
2bb8c34
add inlineInput attribute
dinhtungdu Aug 9, 2022
d90037c
add inlineInput sidebar setting
dinhtungdu Aug 9, 2022
97edad9
add inlineInput help text
dinhtungdu Aug 9, 2022
8e7d426
style the filter button
dinhtungdu Aug 9, 2022
66ba8f4
style price input
dinhtungdu Aug 9, 2022
5eeb706
wip: reset button
dinhtungdu Aug 9, 2022
f6fca92
clicking on reset button will reset the price query
dinhtungdu Aug 10, 2022
ee308b3
support inline input fields
dinhtungdu Aug 10, 2022
eb6d8fc
price text styling update
dinhtungdu Aug 10, 2022
45d357d
fix reset button font size
dinhtungdu Aug 10, 2022
eae7069
add loading placeholder to all elements
dinhtungdu Aug 10, 2022
e84b219
fix filter button style
dinhtungdu Aug 10, 2022
ead9dea
update range slider thumb and track style
dinhtungdu Aug 10, 2022
de08346
fix loading placeholder for non empty query
dinhtungdu Aug 10, 2022
dee7dc6
move reset button into FilterSubmitButton component
dinhtungdu Aug 10, 2022
98f08ef
try: render placeholder serverside
dinhtungdu Aug 11, 2022
b41f15d
update filter button label
dinhtungdu Aug 11, 2022
7b4d9f1
Revert "try: render placeholder serverside"
dinhtungdu Aug 11, 2022
36559ed
remove LoadingPlaceholder component
dinhtungdu Aug 11, 2022
b348935
remove Price: prefix from the current displayed price range
dinhtungdu Aug 11, 2022
2484b2d
update labels
dinhtungdu Aug 12, 2022
4868acb
extract reset button as a dedicated component
dinhtungdu Aug 12, 2022
edb749f
update price text section
dinhtungdu Aug 12, 2022
42d2b82
update reset button behavior
dinhtungdu Aug 12, 2022
d291e8c
avoid breaking filter submit button style for other filter blocks
dinhtungdu Aug 12, 2022
5f29d5a
rename block to Filter by Price
dinhtungdu Aug 12, 2022
bc185d3
fix e2e test
dinhtungdu Aug 12, 2022
79fa2ea
remove border support
dinhtungdu Aug 15, 2022
61e3b37
adjust padding for elments
dinhtungdu Aug 15, 2022
4972bc8
rename panel title
dinhtungdu Aug 15, 2022
7671e4b
Merge branch 'trunk' into fix/6841
dinhtungdu Aug 15, 2022
28b4193
Make the inline option enabled by default and fix frontend rendering
albarin Aug 16, 2022
e462a03
Make the `Price Range Selector` uppercase
albarin Aug 16, 2022
fa041dd
Show `Reset` button only when a selection has been made
albarin Aug 16, 2022
12b4251
Revert the `save` change to avoid the 'Block Recovery Prompt'
albarin Aug 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions assets/js/base/components/filter-reset-button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ import './style.scss';

interface FilterResetButtonProps {
className?: string;
disabled?: boolean;
label?: string;
onClick: () => void;
screenReaderLabel?: string;
}

const FilterResetButton = ( {
className,
disabled,
/* translators: Reset button text for filters. */
label = __( 'Reset', 'woo-gutenberg-products-block' ),
onClick,
Expand All @@ -33,7 +31,6 @@ const FilterResetButton = ( {
className
) }
onClick={ onClick }
disabled={ disabled }
>
<Label label={ label } screenReaderLabel={ screenReaderLabel } />
</button>
Expand Down
9 changes: 2 additions & 7 deletions assets/js/base/components/price-slider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const PriceSlider = ( {
currency,
showInputFields = true,
showFilterButton = false,
inlineInput = false,
inlineInput = true,
isLoading = false,
onSubmit = () => void 0,
}: PriceSliderProps ): JSX.Element => {
Expand Down Expand Up @@ -440,8 +440,7 @@ const PriceSlider = ( {
</div>
) }
<div className="wc-block-components-price-slider__actions">
{ ( showFilterButton ||
minPrice !== minConstraint ||
{ ( minPrice !== minConstraint ||
maxPrice !== maxConstraint ) && (
<FilterResetButton
onClick={ () => {
Expand All @@ -452,10 +451,6 @@ const PriceSlider = ( {
'Reset price filter',
'woo-gutenberg-products-block'
) }
disabled={
minPrice === minConstraint &&
maxPrice === maxConstraint
}
/>
) }
{ showFilterButton && (
Expand Down
2 changes: 1 addition & 1 deletion assets/js/blocks/price-filter/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"inlineInput": {
"type": "boolean",
"default": false
"default": true
},
"showFilterButton": {
"type": "boolean",
Expand Down
5 changes: 5 additions & 0 deletions assets/js/blocks/price-filter/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
}
}

.components-base-control__label {
text-transform: uppercase;
@include font-size(small);
}

.wc-block-price-slider {
.components-placeholder__instructions {
border-bottom: 1px solid #e0e2e6;
Expand Down
2 changes: 1 addition & 1 deletion assets/js/blocks/price-filter/frontend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const getProps = ( el: HTMLElement ) => {
return {
attributes: {
showInputFields: el.dataset.showinputfields === 'true',
inlineInput: el.dataset.inlineInput === 'true',
inlineInput: el.dataset.inlineinput === 'true',
showFilterButton: el.dataset.showfilterbutton === 'true',
heading: el.dataset.heading || blockAttributes.heading.default,
headingLevel: el.dataset.headingLevel
Expand Down
3 changes: 3 additions & 0 deletions assets/js/blocks/price-filter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ registerBlockType( metadata, {
'woo-gutenberg-products-block'
),
headingLevel: 3,
inlineInput: true,
} ),
},
],
Expand All @@ -63,12 +64,14 @@ registerBlockType( metadata, {
showFilterButton,
heading,
headingLevel,
inlineInput,
} = attributes;
const data = {
'data-showinputfields': showInputFields,
'data-showfilterbutton': showFilterButton,
'data-heading': heading,
'data-heading-level': headingLevel,
'data-inlineinput': inlineInput,
albarin marked this conversation as resolved.
Show resolved Hide resolved
};
return (
<div
Expand Down