Skip to content

Conversation

pnengchu
Copy link
Contributor

  • Identified the issue which this PR solves.
  • Read the CONTRIBUTING document.
  • Code builds clean without any errors or warnings.
  • Added appropriate tests for any new functionality.
  • All new and existing tests passed.
  • Added comments in the code, where necessary.
  • Ran make check to catch common errors. Fixed any that came up.

Description:
converted class components to hooks in Icons.js

Which issue(s) this PR fixes:
Part of #923

@pnengchu pnengchu requested a review from Forfold November 16, 2020 20:27
export function Trash() {
const classes = useStyles()

return <TrashIcon className={classes.trashIcon} />
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return <TrashIcon className={classes.trashIcon} />
return <TrashIcon className={classes.trashIcon} {...props} />

Let's pass through any props given to the component declaration. This makes the component more generic and flexible so we can do things like pass HTML attributes to the DOM e.g. <Trash data-cy='my-trash-con' />

Copy link
Contributor

Choose a reason for hiding this comment

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

On second thought, I just checked and we don't have any instances where we actually pass through any additional props, so I'm OK keeping this as is. We can add this back in later if needed.

@pnengchu pnengchu requested a review from dctalbot November 16, 2020 22:02
Copy link
Contributor

@Forfold Forfold left a comment

Choose a reason for hiding this comment

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

lgtm

@pnengchu pnengchu merged commit 81c89be into master Nov 16, 2020
@pnengchu pnengchu deleted the hooks-icons branch November 16, 2020 22:37
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