-
Notifications
You must be signed in to change notification settings - Fork 64
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
feat: create review and ratings section structure #2663
Merged
hellofanny
merged 6 commits into
feat/reviews-and-ratings
from
feat/create-reviews-section
Feb 14, 2025
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
fb74555
feat: create review and ratings section structure
artursantiago 5c5ff5b
fix: lint check
artursantiago 75a7050
refactor: rename to ReviewsAndRatings
artursantiago 6a0e939
fix: rename section nam in sections.json to be the same as the component
artursantiago ccfa471
refactor: update title of the section in sections.json
artursantiago 02ccaa7
feat: change id and classname from review to reviews
artursantiago 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
6 changes: 6 additions & 0 deletions
6
packages/core/src/components/sections/ReviewsAndRatings/DefaultComponents.ts
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,6 @@ | ||
export const ReviewsAndRatingsDefaultComponents = { | ||
// TODO: Update this with the components that will be used in ReviewsAndRatings section | ||
// Olhar o packages/core/src/components/sections/ProductGallery/DefaultComponents.ts | ||
// ou o packages/core/src/components/sections/ProductShelf/DefaultComponents.ts | ||
// para se basear | ||
} as const |
16 changes: 16 additions & 0 deletions
16
...ages/core/src/components/sections/ReviewsAndRatings/OverriddenDefaultReviewsAndRatings.ts
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,16 @@ | ||
import { override } from 'src/customizations/src/components/overrides/ReviewsAndRatings' | ||
import { override as overridePlugin } from 'src/plugins/overrides/ReviewsAndRatings' | ||
import { getOverriddenSection } from 'src/sdk/overrides/getOverriddenSection' | ||
import type { SectionOverrideDefinitionV1 } from 'src/typings/overridesDefinition' | ||
import ReviewsAndRatings from '.' | ||
|
||
/** | ||
* This component exists to support overrides 1.0 | ||
* | ||
* This allows users to override the default ReviewsAndRatings section present in the Headless CMS | ||
*/ | ||
export const OverriddenDefaultReviewsAndRatings = getOverriddenSection({ | ||
...(overridePlugin as SectionOverrideDefinitionV1<'ReviewsAndRatings'>), | ||
...(override as SectionOverrideDefinitionV1<'ReviewsAndRatings'>), | ||
Section: ReviewsAndRatings, | ||
}) |
31 changes: 31 additions & 0 deletions
31
packages/core/src/components/sections/ReviewsAndRatings/ReviewsAndRatings.tsx
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,31 @@ | ||
import { useMemo } from 'react' | ||
|
||
import ReviewsAndRatings from '../../ui/ReviewsAndRatings' | ||
import styles from '../ReviewsAndRatings/section.module.scss' | ||
import Section from '../Section' | ||
import { ReviewsAndRatingsDefaultComponents } from './DefaultComponents' | ||
import { getOverridableSection } from '../../../sdk/overrides/getOverriddenSection' | ||
|
||
interface Props { | ||
title: string | ||
} | ||
const ReviewsAndRatingsSection = ({ title }: Props) => { | ||
return ( | ||
<Section | ||
id="reviews-and-ratings" | ||
className={`${styles.section} section-reviews-and-ratings layout__section`} | ||
> | ||
<ReviewsAndRatings title={title} /> | ||
</Section> | ||
) | ||
} | ||
|
||
const OverridableReviewsAndRatings = getOverridableSection< | ||
typeof ReviewsAndRatingsSection | ||
>( | ||
'ReviewsAndRatings', | ||
ReviewsAndRatingsSection, | ||
ReviewsAndRatingsDefaultComponents | ||
) | ||
|
||
export default OverridableReviewsAndRatings |
1 change: 1 addition & 0 deletions
1
packages/core/src/components/sections/ReviewsAndRatings/index.tsx
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 @@ | ||
export { default } from './ReviewsAndRatings' | ||
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. todo: Rename this file to |
6 changes: 6 additions & 0 deletions
6
packages/core/src/components/sections/ReviewsAndRatings/section.module.scss
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,6 @@ | ||
@layer components { | ||
.section { | ||
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. 🎗️ |
||
// TODO: Ajustar esses componentes para a nova section ReviewsAndRatings | ||
// @import '@faststore/ui/src/components/atoms/Ratings/styles'; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
packages/core/src/components/ui/ReviewsAndRatings/ReviewsAndRatings.tsx
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,13 @@ | ||
export type ReviewsAndRatingsProps = { | ||
title: string | ||
} | ||
|
||
function ReviewsAndRatings({ title, ...otherProps }: ReviewsAndRatingsProps) { | ||
return ( | ||
<> | ||
<h2 className="text__title-section layout__content">{title}</h2> | ||
</> | ||
) | ||
} | ||
|
||
export default ReviewsAndRatings |
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,2 @@ | ||
export { default } from './ReviewsAndRatings' | ||
export type { ReviewsAndRatingsProps } from './ReviewsAndRatings' |
11 changes: 11 additions & 0 deletions
11
packages/core/src/customizations/src/components/overrides/ReviewsAndRatings.tsx
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,11 @@ | ||
// This is an example of how it can be used on the starter. | ||
|
||
import type { SectionOverride } from 'src/typings/overrides' | ||
|
||
const SECTION = 'ReviewsAndRatings' as const | ||
|
||
const override: SectionOverride = { | ||
section: SECTION, | ||
} | ||
|
||
export { override } |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// This is an example of how it can be used on the plugins. | ||
|
||
export { override } from 'src/customizations/src/components/overrides/ReviewsAndRatings' |
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
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.
🎗️