-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add feedback prop to input to support dynamic styling #1196
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1196 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 57 57
Lines 806 807 +1
Branches 312 313 +1
=========================================
+ Hits 806 807 +1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
{ | ||
'ring-inset ring-2': !!feedback || hasError, | ||
'ring-red-error': feedback === 'error' || hasError, | ||
'ring-yellow-notice': feedback === 'warning', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yellow-notice
is the same color we use for notice toast messages.
0a6fbb3
to
7dd1dea
Compare
@@ -27,6 +32,7 @@ const InputRoot = function InputRoot({ | |||
classes, | |||
elementRef, | |||
hasError, | |||
feedback, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since hasError
is deprecated and maps directly to a value of feedback
, I would suggest that you do the mapping at the top of the component and avoid referencing hasError
later. This will make the mapping more obvious and simplify removing hasError
later on.
The name sounds reasonable. Is Bootstrap the only library you looked at or were there others? |
I also checked Material UI, where they call it just I thought |
d0beae4
to
399e79f
Compare
If we only support displaying one feedback state at a time, then indeed a single prop seems a better way to model this. |
399e79f
to
011e61a
Compare
This PR adds a new
feedback
prop toInput
, that can have valueserror
orwarning
, and is used to dynamically style the input to provide extra feedback.It also deprecates and replaces
hasError
, recommendingfeedback"error"
as a direct replacement.