Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
23 changes: 14 additions & 9 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
{
"arrowParens": "avoid",
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all",
"jsxSingleQuote": false,
"printWidth": 80,
"semi": true,
"bracketSpacing": true,
"bracketSameLine": false
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 500,
"editor.fontSize": 15,
"editor.tabSize": 2,
"editor.renderWhitespace": "boundary",
"editor.detectIndentation": false,

"editor.codeActionsOnSave": {
"source.fixAll": "always",
"source.fixAll.eslint": "always"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnType": true,
"editor.formatOnSave": true
}
9 changes: 5 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"devDependencies": {
"@cypress/react18": "^2.0.1",
"@mate-academy/scripts": "^1.8.5",
"@mate-academy/scripts": "^2.1.3",
"@mate-academy/stylelint-config": "*",
"@vitejs/plugin-react": "^4.3.1",
"cypress": "^13.13.0",
Expand Down
12 changes: 8 additions & 4 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import './App.scss';
import React from "react";
import "./App.scss";
import { Sum } from "./components/Sum/Sum";

export const App = () => (
<>
Expand All @@ -8,7 +9,10 @@ export const App = () => (
<p>Sum of 10 and 0 is 10</p>
<p>Sum of 0 and 5 is 5</p>
<p>Sum of 0 and 0 is 0</p>
{/* Replace paragraphs with Sum componets */}
{/* And remove commented lines :) */}
<Sum a={2} b={3} />
<Sum a={-5} b={5} />
<Sum a={10} b={0} />

Choose a reason for hiding this comment

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

According to the requirements, you should only pass the a prop here. This is to test whether the b prop correctly defaults to 0 when it's not provided.

<Sum a={0} b={5} />

Choose a reason for hiding this comment

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

The task requires passing only the b prop in this instance to verify that the a prop defaults to 0 as expected.

<Sum a={0} b={0} />

Choose a reason for hiding this comment

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

This instance of the Sum component should be called without any props to check if both a and b correctly default to 0.

</>
);
8 changes: 7 additions & 1 deletion src/components/Sum/Sum.jsx
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
// export const Sum = () => ();
export const Sum = ({ a = 0, b = 0 }) => {
return (
<p>
Sum of {a} and {b} is {a + b}

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'. Please use a template literal to construct the string, like {`Sum of ${a} and ${b} is ${a + b}`}, to improve readability.

</p>
);
};