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

Add dropdown version of Filter by Rating #7771

Merged
merged 38 commits into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
69067b4
Rename the setting section to match Filter by Attribute
kmanijak Nov 28, 2022
39d8103
Add Display Style toggle to the block settings
kmanijak Nov 28, 2022
22e7aea
Set as a default value of displayStyle for Filter by Rating
kmanijak Nov 29, 2022
0eea6c6
Extend parsing function with displayStyle property
kmanijak Nov 29, 2022
9777ff9
Add dropdown variant of Filter by Rating - not yet working, but compi…
kmanijak Nov 29, 2022
c6712d4
Extend the Editor settings with selectType: single or multiple and qu…
kmanijak Nov 29, 2022
48f2842
Adjust the styles of a FormTokenField to other dropdown
kmanijak Nov 29, 2022
9d90abb
Align Editor settings order and wording between Filter by Attribute a…
kmanijak Nov 30, 2022
6205782
Align styles of the dropdowns between Filter by Attribute and Rating
kmanijak Nov 30, 2022
45273d2
Remove unused property from options in Filter by Attribute
kmanijak Nov 30, 2022
5f0b9cf
Provide translated screen reader messages and placeholder
kmanijak Nov 30, 2022
aa64bd3
Add logic to handle clicking the options in dropdown
kmanijak Nov 30, 2022
71f556d
Revert the label property, which is necessary to display checkbox list
kmanijak Dec 1, 2022
fda8026
Make classname for Rating component optional and remove styling in Fi…
kmanijak Dec 1, 2022
b341ae8
Cover the case when filter with zero products needs string methods fo…
kmanijak Dec 1, 2022
3c55736
Handle Typescript errors and add ts-ignore annotations when necessary
kmanijak Dec 1, 2022
f0e9e36
Remove option to choose query type as it doesn't make sense in the co…
kmanijak Dec 1, 2022
c986975
Remove explicit key prop assignment in Rating component
kmanijak Dec 1, 2022
b579a24
Remove leftover property in type definition
kmanijak Dec 1, 2022
418a99f
Refactor JSX element extension with custom properties to more robust …
kmanijak Dec 1, 2022
6c8d362
Filter by rating tests (#7845)
kmanijak Dec 6, 2022
06950a3
Merge branch 'trunk' into add/filter-by-rating-dropdown
kmanijak Dec 6, 2022
4d5eef9
Adjust the font-size of Filter by Rating dropdown to the rest of the …
kmanijak Dec 6, 2022
40cc877
Fix E2E tests after the Editor settings label has been changed
kmanijak Dec 7, 2022
1ea0678
Improve sorting in Filter by Rating dropdown
kmanijak Dec 8, 2022
6a09198
Use sentence capitalization in dropdown placeholders
kmanijak Dec 8, 2022
df799fd
Change the name of the filter blocks in the test files
kmanijak Dec 8, 2022
f1d4401
Prevent single dropdown input to overflow the wrapper
kmanijak Dec 8, 2022
3cc320f
Remove the unused styles of active options in Filter by Rating
kmanijak Dec 9, 2022
1b662db
Revert the filters placeholder capitalization. Keep the kebab case in…
kmanijak Dec 9, 2022
3f287bc
Change the approach of shared styles to fix the dropdown issue in fil…
kmanijak Dec 9, 2022
93b6f2b
Merge branch 'trunk' into add/filter-by-rating-dropdown
kmanijak Dec 9, 2022
0e316a1
Merge branch 'trunk' into add/filter-by-rating-dropdown
kmanijak Dec 12, 2022
c5affc6
Merge branch 'trunk' into add/filter-by-rating-dropdown
kmanijak Dec 12, 2022
428e8bf
Merge branch 'trunk' into add/filter-by-rating-dropdown
gigitux Dec 12, 2022
1cf6ae6
Fix the Filter by Rating with Products block
kmanijak Dec 12, 2022
92cad7e
Align the logic of getting the filters from URL for Filter by Rating …
kmanijak Dec 12, 2022
54df927
Merge branch 'trunk' into add/filter-by-rating-dropdown
kmanijak Dec 13, 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
10 changes: 5 additions & 5 deletions assets/js/base/components/product-rating/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import './style.scss';

const Rating = ( {
className,
key,
rating,
ratedProductsCount,
}: RatingProps ): JSX.Element => {
Expand Down Expand Up @@ -39,7 +38,7 @@ const Rating = ( {
};

return (
<div className={ ratingClassName } key={ key }>
<div className={ ratingClassName }>
<div
className={ 'wc-block-components-product-rating__stars' }
role="img"
Expand All @@ -58,10 +57,11 @@ const Rating = ( {
</div>
);
};

export type RatingValues = 0 | 1 | 2 | 3 | 4 | 5;
interface RatingProps {
className: string;
key: 0 | 1 | 2 | 3 | 4 | 5;
rating: 0 | 1 | 2 | 3 | 4 | 5;
className?: string;
rating: RatingValues;
ratedProductsCount?: number | null;
}

Expand Down
2 changes: 1 addition & 1 deletion assets/js/blocks/attribute-filter/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ const Edit = ( {
>
<ToggleControl
label={ __(
'Include product count',
'Display product count',
'woo-gutenberg-products-block'
) }
checked={ showCounts }
Expand Down
9 changes: 9 additions & 0 deletions assets/js/blocks/attribute-filter/style.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import "../shared/styles/style";

.wp-block-woocommerce-attribute-filter {
// We need to override it because by default the global styles applied the border-style: solid;
// Our goal is not to have a border on main wrapper DOM element
Expand Down Expand Up @@ -27,6 +29,8 @@
}

&.style-dropdown {
@include includeFormTokenFieldFix();

position: relative;
display: flex;
gap: $gap;
Expand Down Expand Up @@ -76,12 +80,17 @@
&.is-loading {
border-radius: em(4px);
}

.components-form-token-field {
border-radius: inherit;
}
Aljullu marked this conversation as resolved.
Show resolved Hide resolved
}

.wc-blocks-components-form-token-field-wrapper .components-form-token-field__input-container {
@include reset-typography();
border: 0;
padding: $gap-smaller;
border-radius: inherit;

.components-form-token-field__input {
@include font-size(small);
Expand Down
2 changes: 1 addition & 1 deletion assets/js/blocks/attribute-filter/test/block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ const setupWithoutSelectedFilterAttributes = () => {
};
};

describe( 'AttributeFilterBlock', () => {
describe( 'Filter by Attribute block', () => {
describe( 'Given no filter attribute is selected when page loads', () => {
test( 'should disable Apply button when page loads', () => {
const { applyButton } = setupWithoutSelectedFilterAttributes();
Expand Down
8 changes: 8 additions & 0 deletions assets/js/blocks/rating-filter/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,18 @@
"type": "boolean",
"default": true
},
"displayStyle": {
"type": "string",
"default": "list"
},
"showFilterButton": {
"type": "boolean",
"default": false
},
"selectType": {
"type": "string",
"default": "multiple"
},
"isPreview": {
"type": "boolean",
"default": false
Expand Down
Loading