Skip to content
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

#168078593 Create a reusable card component #266

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

oluwajuwon
Copy link
Collaborator

What Does This PR Do?

This PR creates a re-usable card component

Description Of Task To Be Completed

  • Write test for card component
  • Create a card component to be reusable
  • Add styling to the card component

Any Background Context You Want To Provide?

N/A

How can this be manually tested?

  • Fetch the branch locally by running git fetch origin ft-reusable-card-168078593 & git checkout ft-reusable-card-168078593 respectively
  • Open the revampedClient/components/cards/Card.jsx folder
  • Launch the app

What are the relevant pivotal tracker stories?

#168078593

Screenshot(s)

N/A

@okellogabrielinnocent
Copy link
Collaborator

@oluwajuwon thanks for the good work, is it possible to add screenshot so that we are able to see the changes

return (
<div
className="card"
style={{
Copy link
Collaborator

@Luckzman Luckzman Aug 29, 2019

Choose a reason for hiding this comment

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

I think it will be a good approach to pass style as props in className in steady of allowing height and width to be passed in as props.
Something like this <div className={card ${classes}}>

Copy link
Collaborator

Choose a reason for hiding this comment

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

Great work @oluwajuwon, implement @Luckzman's feedback as this will make the component much more dynamic and reusable

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

hmmm, that makes sense @Luckzman I'll look into that

@@ -0,0 +1,6 @@

.card {
padding: 10px;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think there should be a default height and width based on the design.

return (
<div
className="card"
style={{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Great work @oluwajuwon, implement @Luckzman's feedback as this will make the component much more dynamic and reusable

@oluwajuwon oluwajuwon added the wip label Aug 29, 2019
@oluwajuwon oluwajuwon force-pushed the ft-reusable-card-168078593 branch from 042c7db to d22d3d5 Compare August 29, 2019 12:54
@oluwajuwon oluwajuwon added Ready for review the pr is ready for review and removed wip labels Sep 2, 2019
describe('Card component', () => {
it('should render correctly', () => {
const props = {
height: '10px',
Copy link
Collaborator

Choose a reason for hiding this comment

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

the required props for the Card component is style and children, why add height and width as props in your test

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah I forgot about that when I made the previous change lol. thanks

import PropTypes from 'prop-types';
import '../../assets/components/_card.scss';

const Card = (props) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think jsDoc will make sense here for the sake of documentation

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

will add that. 👍

Copy link
Collaborator

@Luckzman Luckzman left a comment

Choose a reason for hiding this comment

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

Nice work, pls attend to my comments on your PR.

@oluwajuwon oluwajuwon force-pushed the ft-reusable-card-168078593 branch 2 times, most recently from 83cfb5e to dcb0808 Compare September 5, 2019 15:52
};

Card.propTypes = {
children: PropTypes.string.isRequired,
Copy link
Collaborator

@Luckzman Luckzman Sep 5, 2019

Choose a reason for hiding this comment

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

I think children should have PropTypes.node.isRequired since the children props will take jsx

Copy link
Collaborator Author

@oluwajuwon oluwajuwon Sep 6, 2019

Choose a reason for hiding this comment

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

lol I didn't even know there was something like that. thanks

@oluwajuwon oluwajuwon force-pushed the ft-reusable-card-168078593 branch from dcb0808 to 3b752dc Compare September 6, 2019 12:53
- write test for card component
- create card component to be reusable
- add styling to the card component
- fix jest configuration
- add setup files for enzyme and jest

[Delivers #168078593]
@oluwajuwon oluwajuwon force-pushed the ft-reusable-card-168078593 branch from 3b752dc to 6e72493 Compare September 16, 2019 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready for review the pr is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants