-
Notifications
You must be signed in to change notification settings - Fork 0
Updated the fade-in effect on reveal of enhanced text and fix other issues on feedback #83
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
Conversation
| let overlay = null | ||
|
|
||
| React.Children.forEach(children, child => { | ||
| if (child.type && child.type.displayName === 'PromptInputTextarea') { |
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.
Can we check if child.type is defined once at the top?
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.
Refactored the code and created separate helper for type checking logic
| {textarea} | ||
| {overlay} | ||
| {actions} | ||
| {React.Children.map(children, child => { |
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.
Some thoughts here:
- We do something similar above, so we can move type checking logic to a separate helper, wyt?
- Are we doing this to make sure the components that are not textarea, overlay, and actions will go after these three?
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.
- Refactored the code and created separate helper for type checking logic
- Yes, the first 3 components should be rendered first before the other children because it affects the positioning of the text when it will be displayed by the overlay.
| } | ||
| }, [text]) | ||
|
|
||
| useEffect(() => { |
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.
Could you add some short comments to all useEffect hooks in this component?
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.
Maybe it would be good to move all those useEffects to a separate hook?
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.
Added some comments to the useEffect but did not move into a separate hook since it's only being used by this component.
| overlay.style.position = 'absolute' | ||
| overlay.style.top = paddingTop | ||
| overlay.style.left = paddingLeft | ||
| overlay.style.width = 'calc(100% - ' + (parseInt(paddingLeft) * 2) + 'px)' |
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.
Could you use template string here?
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.
Refactored code to use template string.
| {paragraphs.map((paragraph, index) => ( | ||
| <p | ||
| key={index} | ||
| className={`ds-prompt-input__text-reveal-paragraph ${ |
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.
use classnames?
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.
Refactored code to use classnames
…o check displayName
Docs