scientist-softserv / webstore-component-library

A React component library intended for use with WebStore applications.
https://www.npmjs.com/package/@scientist-softserv/webstore-component-library
2 stars 0 forks source link

update Link prop types #165

Closed alishaevn closed 1 year ago

alishaevn commented 1 year ago

ref: https://github.com/scientist-softserv/webstore-component-library/pull/162#discussion_r1113394129

story

in the pr above, the Link component was changed to no longer require a label. that means however that both the "icon" and "label" values are not required. for a Link, this should not be. it should be required that there is some type of value that the user clicks in order to be directed somewhere.

acceptance criteria

summer-cook commented 1 year ago

Maybe something like this: https://stackoverflow.com/questions/54751283/react-proptypes-at-least-one-of-these-props-must-be-provided

alishaevn commented 1 year ago

Maybe something like this: https://stackoverflow.com/questions/54751283/react-proptypes-at-least-one-of-these-props-must-be-provided

^ unsure. in my experience, the oneOf function is used to make sure that the value of a specific key is one of the listed values, like this.

I was thinking of instead of something like the below. but it's just my first thought. we may explore other solutions.

prop: PropTypes.exact({
  label: PropTypes.string,
  icon: Proptypes.string,
}).isRequired