Skip to content

feat: add Sum component#4291

Open
IronHedgehog wants to merge 2 commits into
mate-academy:masterfrom
IronHedgehog:develop
Open

feat: add Sum component#4291
IronHedgehog wants to merge 2 commits into
mate-academy:masterfrom
IronHedgehog:develop

Conversation

@IronHedgehog
Copy link
Copy Markdown

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Your implementation has two critical issues that violate explicit requirements: 1. Template literals violation [CHECKLIST #2]: The Sum component uses {a}, {b}, and {a + b} as separate JSX expressions instead of template literals. Change the paragraph content to use a single template literal: `<p>Sum of ${a} and ${b} is ${a + b}</p>`. 2. Props passing requirement violations: Three instances in App.jsx incorrectly pass explicit 0 values: - <Sum a={10} b={0} /> should be <Sum a={10} /> (requirement: "just a = 10") - <Sum a={0} b={5} /> should be <Sum b={5} /> (requirement: "just b = 5") - <Sum a={0} b={0} /> should be <Sum /> (requirement: "no params at all"). The default parameter values in Sum should be tested by omitting those props, not by explicitly passing 0. Passing 0 means the prop is being passed (with value 0), which defeats the purpose of testing the default behavior. These fixes will align your code with both the task requirements and the checklist items. The component logic itself is correct—just needs these adjustments to match the specification exactly.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread src/App.jsx
Comment on lines +2 to 3
import { Sum } from './components/Sum/Sum';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This violates checklist item #2: Use string interpolation inside tag content. Use template literals instead of separate expressions. Change to: {Sum of ${a} and ${b} is ${a + b}}

Comment thread src/App.jsx Outdated
{/* And remove commented lines :) */}
<Sum a={2} b={3} />
<Sum a={-5} b={5} />
<Sum a={10} b={0} />
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The requirement specifies 'just a = 10' with no b param. Passing b={0} explicitly means b is passed, not defaulted. Change to:

Comment thread src/App.jsx Outdated
<Sum a={2} b={3} />
<Sum a={-5} b={5} />
<Sum a={10} b={0} />
<Sum a={0} b={5} />
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The requirement specifies 'just b = 5' with no a param. Passing a={0} explicitly means a is passed, not defaulted. Change to:

Comment thread src/App.jsx Outdated
<Sum a={-5} b={5} />
<Sum a={10} b={0} />
<Sum a={0} b={5} />
<Sum a={0} b={0} />
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The requirement specifies 'no params at all'. Passing a={0} b={0} means params are passed. Change to:

Comment thread src/components/Sum/Sum.jsx Outdated
Comment on lines +1 to +3
export const Sum = ({ a = 0, b = 0 }) => (
<p>
Sum of {a} and {b} is {a + b}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This violates checklist item #2: Use string interpolation inside tag content. The paragraph should use a template literal like {Sum of ${a} and ${b} is ${a + b}} instead of separate JSX expressions.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Your implementation fully meets all requirements. The Sum component correctly uses a named export, accepts a and b props with default values of 0, and renders the text using template literals as specified. The App component properly includes all five required Sum instances, testing default parameters by omitting props where appropriate rather than passing explicit 0 values. The CI workflow failures are unrelated to your code—they're caused by GitHub Actions infrastructure issues when downloading action archives from codeload.github.com. This is a transient infrastructure problem that doesn't reflect any issues with your implementation. Once the infrastructure issue is resolved, your code should pass all checks without any modifications.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Copy link
Copy Markdown

@vitalii-bondarenko-ua vitalii-bondarenko-ua left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants