Commit 66b0345
fix: declare RatingSummary in section components (#2707)
## What's the purpose of this pull request?
This pull request includes some changes to the `RatingSummary` component
and its integration within the `ReviewsAndRatings` section, like adding
a callback for the create review button, dynamically importing the
`RatingSummary` component, and updating the `ReviewsAndRatings` section
to use the new properties and overrides.
## How it works?
Enhancements to `RatingSummary` component:
* Added `onCreateReviewClick` callback property to `RatingSummaryProps`
to handle create review button clicks.
[[1]](diffhunk://#diff-3842b6542c4617b9089bcfe95aae46869139ddb93e8dcd66334f2e63bea0f669R43-R46)
[[2]](diffhunk://#diff-3842b6542c4617b9089bcfe95aae46869139ddb93e8dcd66334f2e63bea0f669R96)
[[3]](diffhunk://#diff-3842b6542c4617b9089bcfe95aae46869139ddb93e8dcd66334f2e63bea0f669L110-R115)
Integration of `RatingSummary` in `ReviewsAndRatings` section:
* Dynamically imported `RatingSummary` component in
`ReviewsAndRatingsDefaultComponents`.
* Updated `ReviewsAndRatingsSection` to pass new properties
(`ratingSummary`, `addReviewModal`) to `ReviewsAndRatings` component.
* Modified `ReviewsAndRatings` component to accept and use new
properties (`ratingSummary`, `addReviewModal`) and to use the overridden
`RatingSummary` component.
[[1]](diffhunk://#diff-3240d26fcff836d6cf071f404185609676c1bd28d2adaad248e94c88efae1e86R4-R27)
[[2]](diffhunk://#diff-3240d26fcff836d6cf071f404185609676c1bd28d2adaad248e94c88efae1e86L21-R45)
Type definitions update:
* Added `RatingSummaryProps` to overrides type definitions and updated
`SectionsOverrides` to include `RatingSummary` component.
[[1]](diffhunk://#diff-493fb3077e5ff0ebee6d765533eda8dd478cbb7ef439d8fbc526fd9bed7daa7cR45)
[[2]](diffhunk://#diff-493fb3077e5ff0ebee6d765533eda8dd478cbb7ef439d8fbc526fd9bed7daa7cL363-R369)
## How to test it?
- You can check the starter build on the starter preview of the branch
bellow that is already using this changes:
> - #2695
---------
Co-authored-by: Fanny Chien <[email protected]>1 parent 87d1131 commit 66b0345
File tree
5 files changed
+44
-16
lines changed- packages
- components/src/organisms/RatingSummary
- core/src
- components
- sections/ReviewsAndRatings
- ui/ReviewsAndRatings
- typings
5 files changed
+44
-16
lines changedLines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
43 | 47 | | |
44 | 48 | | |
45 | 49 | | |
| |||
89 | 93 | | |
90 | 94 | | |
91 | 95 | | |
| 96 | + | |
92 | 97 | | |
93 | 98 | | |
94 | 99 | | |
| |||
107 | 112 | | |
108 | 113 | | |
109 | 114 | | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
| 115 | + | |
114 | 116 | | |
115 | 117 | | |
116 | 118 | | |
| |||
Lines changed: 8 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
1 | 8 | | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
| 9 | + | |
6 | 10 | | |
Lines changed: 7 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
10 | | - | |
| 12 | + | |
| 13 | + | |
11 | 14 | | |
12 | | - | |
| 15 | + | |
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
18 | | - | |
| 21 | + | |
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
| |||
Lines changed: 16 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | 1 | | |
3 | 2 | | |
| 3 | + | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
7 | 12 | | |
8 | 13 | | |
9 | | - | |
| 14 | + | |
10 | 15 | | |
| 16 | + | |
11 | 17 | | |
12 | 18 | | |
13 | 19 | | |
| |||
18 | 24 | | |
19 | 25 | | |
20 | 26 | | |
21 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
22 | 35 | | |
23 | 36 | | |
24 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
360 | 361 | | |
361 | 362 | | |
362 | 363 | | |
363 | | - | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
364 | 370 | | |
365 | 371 | | |
366 | 372 | | |
| |||
0 commit comments