Skip to content

Commit

Permalink
edited feedback and app components added css
Browse files Browse the repository at this point in the history
  • Loading branch information
MaggieWesolowska committed May 17, 2023
1 parent 3842e41 commit 8bd6f44
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 18 deletions.
47 changes: 39 additions & 8 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"@testing-library/jest-dom": "^5.16.3",
"@testing-library/react": "^12.1.4",
"@testing-library/user-event": "^13.5.0",
"nanoid": "^4.0.2",
"prop-types": "^15.8.1",
"react": "^18.1.0",
"react-dom": "^18.1.0",
Expand Down
16 changes: 14 additions & 2 deletions src/components/App.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import React, { Component } from 'react';
// import { SectionTitle } from './SectionTitle/SectionTitle';
// import { Statistics } from './Statistics/Statistics';
// import { FeedbackOptions } from './FeedbackOptions/FeedbackOptions';
// import { Notification } from './Notification/Notification';

export class App extends Component {
state = {
Expand All @@ -8,7 +11,10 @@ export class App extends Component {
bad: 0,
};

countTotalFeedback = () => {};
countTotalFeedback = () => {
let total = this.state.good + this.state.neutral + this.state.bad;
return total;
};

countPositiveFeedbackPercentage = () => {};

Expand All @@ -23,7 +29,13 @@ export class App extends Component {
fontSize: 40,
color: '#010101',
}}
></div>
>
{/* <SectionTitle title="Please leave feedback">
<FeedbackOptions />
</SectionTitle>
<Statistics />
<Notification message="There is no feedback" /> */}
</div>
);
}
}
23 changes: 20 additions & 3 deletions src/components/FeedbackOptions/FeedbackOptions.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
// import PropTypes from 'prop-types';
import propTypes from 'prop-types';
import css from './FeedbackOptions.module.css';
import { nanoid } from 'nanoid';

export const FeedbackOptions = (options, onLeaveFeedback) => {
return {};
export const FeedbackOptions = ({ options, onLeaveFeedback }) => (
<div>
{options.map(option => (
<button
key={nanoid()}
onClick={() => onLeaveFeedback(option)}
className={css.feedbackBtn}
>
{option}
</button>
))}
</div>
);

FeedbackOptions.propTypes = {
options: propTypes.arrayOf(propTypes.string).isRequired,
onLeaveFeedback: propTypes.func.isRequired,
};
13 changes: 13 additions & 0 deletions src/components/FeedbackOptions/FeedbackOptions.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.feedbackBtn {
.search-btn {
color: #fff;
padding: 5px 5px;
font-size: 15px;
border-radius: 5px;
border: none;
cursor: pointer;
background: #6e6d70;
letter-spacing: 0.04em;
transition: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}
}
4 changes: 2 additions & 2 deletions src/components/Notification/Notification.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import PropTypes from 'prop-types';
import propTypes from 'prop-types';

export const Notification = ({ message }) => <p>{message}</p>;

Notification.propTypes = {
message: PropTypes.string.isRequired,
message: propTypes.string.isRequired,
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import PropTypes from 'prop-types';
import propTypes from 'prop-types';

export const SectionTitle = ({ title, children }) => (
<div>
Expand All @@ -8,6 +8,6 @@ export const SectionTitle = ({ title, children }) => (
);

SectionTitle.propTypes = {
title: PropTypes.string.isRequired,
children: PropTypes.string.isRequired,
title: propTypes.string.isRequired,
children: propTypes.node.isRequired,
};

0 comments on commit 8bd6f44

Please sign in to comment.