tleunen / react-mdl

React Components for Material Design Lite
https://tleunen.github.io/react-mdl/
MIT License
1.76k stars 255 forks source link

Allow extra props on Badge component #422

Closed HriBB closed 7 years ago

HriBB commented 7 years ago

Adds the ability to pass extra props such as onClick handler on Badge component. @tleunen please let me know if this makes sense.

tleunen commented 7 years ago

I don't mind adding it for consistency, but in theory, because Badge only clones the child, you can pass the onClick on the child directly

codecov-io commented 7 years ago

Current coverage is 99.36% (diff: 100%)

Merging #422 into master will not change coverage

Diff Coverage File Path
•••••••••• 100% src/Badge/index.js

Powered by Codecov. Last update 768b3f4...67cde10

HriBB commented 7 years ago

It's because react-portal adds a click handler dynamically on target prop.

<Menu target={<Badge text="2" overlap><IconButton name={'person'}/></Badge>} align={'tr tr'}>
  <MenuItem/>
  <MenuItem/>
  <MenuItem/>
</Menu>