feat(button): adding active prop to Button#42
feat(button): adding active prop to Button#42gopalgoel19 wants to merge 2 commits intomicrosoft:masterfrom gopalgoel19:active
Conversation
|
in the PR description you mention disabled property, but I do not see any change related to that property in the files. |
|
@jurokapsiar It was a typo. I meant to say |
There was a problem hiding this comment.
it seems to be a more complex story around this. Button could be of primary or secondary type - and for these types its visual look should differ. Currently it seems that only the case of default button is handled.
There was a problem hiding this comment.
Ah, I didn't think of that. Let me work on it.
There was a problem hiding this comment.
should this have the px-to-rem helper?
There was a problem hiding this comment.
I am not sure what that does. What do you suggest?
There was a problem hiding this comment.
@gopalgoel19, essentially it is about using pxToRem() helper function. You should think about whether this function should be used in your case or not - the rule is the following: if you would like your size to adapt font size changes (for example, if browser uses large font size for rendering page content you would like your sizes being proportionally larger as well), you should rem units instead of pixels. Seems that in your case rem units are more appropriate, as button's border should be thicker in case if font size is increased.
Please, use the following code snippet as an example (imageVariables.ts):
export default () => ({
....
avatarRadius: pxToRem(9999),
avatarSize: pxToRem(32),
})There was a problem hiding this comment.
oops, merge conflict is not resolved
There was a problem hiding this comment.
could be done a bit succinctly:
borderWidth: `${secondary ? pxToRem(circular ? 1 : 2) : 0}`,There was a problem hiding this comment.
That is a nice suggestion.
There was a problem hiding this comment.
the same here - more succinct expression could be used, to avoid duplication
There was a problem hiding this comment.
nit: also, it would be a bit easier to read if there would be no negation in the condition:
borderWidth: `${active ? 0 : pxToRem(circular ? 1 : 2) }`,
Button(
activeprop )This PR will introduce possibility to specify
activebuttons. Most of the code logic have been picked up from #14.TODO
API Proposal
active
activeproperty will make buttons in active state by manipulating backgroundColor