@graphcommerce/magento-review 2.109.1 → 2.111.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,41 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [2.111.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-review@2.110.2...@graphcommerce/magento-review@2.111.0) (2021-12-01)
7
+
8
+
9
+ ### Features
10
+
11
+ * borderRadius based on theme.shape.borderRadius ([7c34937](https://github.com/ho-nl/m2-pwa/commit/7c349376cd41a131c628324c299106fdb7e60484))
12
+
13
+
14
+
15
+
16
+
17
+ # [2.110.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-review@2.109.1...@graphcommerce/magento-review@2.110.0) (2021-11-22)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * allow styling from parent ([ed1b4dc](https://github.com/ho-nl/m2-pwa/commit/ed1b4dc446fa19244cc73f87063256809b914d15))
23
+ * cleanup ([7937ac5](https://github.com/ho-nl/m2-pwa/commit/7937ac5c6163a4ffe10d8a8d61847fcc86e82a9d))
24
+ * make stylable ([54aea4c](https://github.com/ho-nl/m2-pwa/commit/54aea4c177c708de07df9ef9c590da6bff43aea8))
25
+ * remove styles ([fabde1f](https://github.com/ho-nl/m2-pwa/commit/fabde1f1dba9f75dea60bb2c7c69d4793c6197cd))
26
+ * rename summary chip fragment ([bb23dfc](https://github.com/ho-nl/m2-pwa/commit/bb23dfc8bb82e99832196b4080d2c4c9f269cc5d))
27
+ * revert to SvgImageSimple ([b247c6b](https://github.com/ho-nl/m2-pwa/commit/b247c6b96979bc313e597a8ffe1275b73f38bd6a))
28
+ * review form size large ([9f45336](https://github.com/ho-nl/m2-pwa/commit/9f45336d310b120088fe6440dd95a51944ff77cb))
29
+ * use fragment types ([0a06309](https://github.com/ho-nl/m2-pwa/commit/0a0630916e191c59eed402904b9ace6b87831bd8))
30
+
31
+
32
+ ### Features
33
+
34
+ * add ReviewSummary component ([b823669](https://github.com/ho-nl/m2-pwa/commit/b823669d32e92238d05cac181c3453a13da49601))
35
+ * use Rating component ([ec54f45](https://github.com/ho-nl/m2-pwa/commit/ec54f4522adb2d330bbdecc2ce032f86f13fb7a6))
36
+
37
+
38
+
39
+
40
+
6
41
  # [2.109.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-review@2.108.6...@graphcommerce/magento-review@2.109.0) (2021-11-12)
7
42
 
8
43
 
@@ -36,7 +36,6 @@ const useStyles = makeStyles(
36
36
  submitButton: {
37
37
  width: responsiveVal(200, 250),
38
38
  height: responsiveVal(40, 50),
39
- borderRadius: responsiveVal(20, 25),
40
39
  },
41
40
  cancelButton: {
42
41
  display: 'block',
@@ -139,6 +138,7 @@ export default function CreateProductReviewForm(props: CreateProductReviewFormPr
139
138
  {prrvm && (
140
139
  <StarRatingField
141
140
  id={prrvm?.id ?? ''}
141
+ size='large'
142
142
  onChange={(id, value) => {
143
143
  const productReviewRatingInputValue =
144
144
  data.productReviewRatingsMetadata.items.find((meta) => meta?.id === id)?.values[
@@ -0,0 +1,4 @@
1
+ fragment ProductReviewSummaryChip on ProductInterface
2
+ @inject(into: ["ProductListItem", "ProductPageItem"]) {
3
+ rating_summary
4
+ }
@@ -6,30 +6,10 @@ export type ProductReviewChipProps = {
6
6
  rating?: number
7
7
  reviewSectionId?: string
8
8
  max?: number
9
- shapeOnly?: boolean
10
9
  } & ChipProps
11
10
 
12
11
  const useStyles = makeStyles(
13
12
  (theme: Theme) => ({
14
- ratingContainer: {
15
- width: '100%',
16
- position: 'relative',
17
- },
18
- rating: {
19
- position: 'absolute',
20
- overflow: 'hidden',
21
- '& > img': {
22
- display: 'inline',
23
- },
24
- zIndex: 1,
25
- },
26
- maxRating: {
27
- opacity: 0.4,
28
- '& > img': {
29
- display: 'inline',
30
- filter: 'grayscale(100%)',
31
- },
32
- },
33
13
  iconStar: {
34
14
  stroke: '#FFDA1C',
35
15
  fill: '#FFDA1C',
@@ -39,7 +19,7 @@ const useStyles = makeStyles(
39
19
  )
40
20
 
41
21
  export default function ProductReviewChip(props: ProductReviewChipProps) {
42
- const { rating, reviewSectionId = '', shapeOnly = false, max = 5, ...chipProps } = props
22
+ const { rating, reviewSectionId = '', max = 5, ...chipProps } = props
43
23
  const classes = useStyles()
44
24
 
45
25
  if (!rating) return null
@@ -0,0 +1,63 @@
1
+ import { SvgImageSimple, iconStar, responsiveVal, UseStyles } from '@graphcommerce/next-ui'
2
+ import { makeStyles, Theme } from '@material-ui/core'
3
+ import { ProductReviewSummaryFragment } from './ProductReviewSummary.gql'
4
+ import React from 'react'
5
+
6
+ export type ProductReviewSummaryProps = ProductReviewSummaryFragment & UseStyles<typeof useStyles>
7
+
8
+ const useStyles = makeStyles(
9
+ (theme: Theme) => ({
10
+ root: {
11
+ width: 'max-content',
12
+ position: 'relative',
13
+ '& > div': {
14
+ lineHeight: 0,
15
+ },
16
+ },
17
+ rating: {
18
+ position: 'absolute',
19
+ top: 0,
20
+ overflow: 'hidden',
21
+ '& > div': {
22
+ whiteSpace: 'nowrap',
23
+ },
24
+ },
25
+ iconStar: {
26
+ stroke: 'none',
27
+ fill: '#FFDA1C',
28
+ },
29
+ iconStarDisabled: {
30
+ stroke: 'none',
31
+ fill: theme.palette.grey[300],
32
+ },
33
+ }),
34
+ { name: 'ProductListReviewSummary' },
35
+ )
36
+
37
+ export default function ProductReviewSummary(props: ProductReviewSummaryProps) {
38
+ const { rating_summary } = props
39
+ const classes = useStyles(props)
40
+
41
+ if (!rating_summary) return null
42
+
43
+ return (
44
+ <div className={classes.root}>
45
+ <div>
46
+ <SvgImageSimple src={iconStar} size='xs' className={classes.iconStarDisabled} />
47
+ <SvgImageSimple src={iconStar} size='xs' className={classes.iconStarDisabled} />
48
+ <SvgImageSimple src={iconStar} size='xs' className={classes.iconStarDisabled} />
49
+ <SvgImageSimple src={iconStar} size='xs' className={classes.iconStarDisabled} />
50
+ <SvgImageSimple src={iconStar} size='xs' className={classes.iconStarDisabled} />
51
+ </div>
52
+ <div className={classes.rating} style={{ width: `${rating_summary}%` }}>
53
+ <div>
54
+ <SvgImageSimple src={iconStar} size='xs' className={classes.iconStar} />
55
+ <SvgImageSimple src={iconStar} size='xs' className={classes.iconStar} />
56
+ <SvgImageSimple src={iconStar} size='xs' className={classes.iconStar} />
57
+ <SvgImageSimple src={iconStar} size='xs' className={classes.iconStar} />
58
+ <SvgImageSimple src={iconStar} size='xs' className={classes.iconStar} />
59
+ </div>
60
+ </div>
61
+ </div>
62
+ )
63
+ }
@@ -3,11 +3,13 @@ export { default as CreateProductReviewForm } from './CreateProductReviewForm'
3
3
  export { default as CustomerReview } from './CustomerReview'
4
4
  export { default as ProductReviews } from './ProductReviews'
5
5
  export { default as ProductReviewChip } from './ProductReviewChip'
6
+ export { default as ProductReviewSummary } from './ProductReviewSummary'
6
7
 
7
8
  export * from './AccountReviews/AccountReviews.gql'
8
9
  export * from './ProductReviews'
9
10
  export * from './CustomerReview/CustomerReview.gql'
10
- export * from './ProductReviewChip/ProductReviewSummary.gql'
11
+ export * from './ProductReviewSummary/ProductReviewSummary.gql'
12
+ export * from './ProductReviewChip/ProductReviewSummaryChip.gql'
11
13
  export * from './ProductReviews/ProductReviewProductName.gql'
12
14
  export * from './CreateProductReviewForm/CreateProductReview.gql'
13
15
  export * from './CreateProductReviewForm/ProductReviewRatingsMetadata.gql'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphcommerce/magento-review",
3
- "version": "2.109.1",
3
+ "version": "2.111.0",
4
4
  "sideEffects": false,
5
5
  "prettier": "@graphcommerce/prettier-config-pwa",
6
6
  "browserslist": [
@@ -23,10 +23,10 @@
23
23
  "@apollo/client": "^3.4.16",
24
24
  "@graphcommerce/graphql": "^2.105.5",
25
25
  "@graphcommerce/image": "^2.105.4",
26
- "@graphcommerce/magento-customer": "^3.6.1",
27
- "@graphcommerce/magento-product": "^3.6.1",
28
- "@graphcommerce/magento-store": "^3.3.1",
29
- "@graphcommerce/next-ui": "^3.17.1",
26
+ "@graphcommerce/magento-customer": "^3.6.5",
27
+ "@graphcommerce/magento-product": "^3.7.0",
28
+ "@graphcommerce/magento-store": "^3.3.5",
29
+ "@graphcommerce/next-ui": "^3.19.0",
30
30
  "@graphcommerce/react-hook-form": "^2.104.0",
31
31
  "@lingui/macro": "^3.12.1",
32
32
  "@material-ui/core": "^4.12.3",
@@ -37,5 +37,5 @@
37
37
  "react-dom": "^17.0.2",
38
38
  "schema-dts": "^1.0.0"
39
39
  },
40
- "gitHead": "e8578cc336e58d896531179f5fcb6973e8a983ce"
40
+ "gitHead": "f079c0b5b96dd1a048ca4d3c1d07916353c6bc33"
41
41
  }