-
Notifications
You must be signed in to change notification settings - Fork 60
[UIK-4127][feedback-form] added illustrationElement/NoticeComponent props #2659
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
base: release/v16
Are you sure you want to change the base?
[UIK-4127][feedback-form] added illustrationElement/NoticeComponent props #2659
Conversation
|
|
||
| class FeedbackRatingRoot extends Component< | ||
| FeedbackRatingProps, | ||
| FeedbackRatingProps & { NoticeComponent: typeof FeedbackRatingRoot.defaultProps['NoticeComponent'] }, |
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.
I think, you shouldn't set type here if you have NoticeComponent in the FeedbackRatingProps
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.
updated
| /** Illustration element */ | ||
| illustrationElement?: React.ReactElement; | ||
| /** Notice smart component like NoticeSmart/NoticeFH */ | ||
| NoticeComponent?: React.ComponentType<NoticeSmartProps>; |
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.
what do you think about just Illustration and Notice - both from upper case and with specifics in type?
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.
P.S.
Illustration?: Intergalactic.Component<'svg', IllustrationProps>;
Notice?: typeof Notice;
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.
updated
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.
additionally noticed one thing, jfyi
we have to be care with Intergalactic.Compoent type as prop. That is why React.ComponentType<NoticeSmartProps> is used in that context. The downside of that approach is that it could miss internal props like tag render, etc...
Example:
type Props = {
Test: Intergalactic.Component<'div', NoticeSmartProps>;
}I expect that only components that implement NoticeSmartProps will be a valid input (yeah, I know that NoticeSmartProps is extended by BoxProps and vast majority of components are extended too..., but...)
POV:
<Component Test={Box} />and TS won't tell anything :)
| <Notice.Close onClick={onNotificationClose} /> | ||
| </Notice> | ||
|
|
||
| <Notice.Text tag={Flex} gap={3} alignItems={notificationTitle ? 'flex-start' : 'center'}> |
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.
I think - this is incorrect to use Notice.Text here - it should be NoticeComponent.Text.
I see the problem, maybe we need to transform a little Notice in FeatureHighlight - add some advanced mode or something like this to use advanced Notice.
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.
updated
| } | ||
|
|
||
| SFeedbackRatingNoticeComponent > *[data-ui-name="Notice.Label"] { | ||
| margin-right: var(--intergalactic-spacing-3x, 12px); |
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.
And after replacing the Notice, you don't need to use this style
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.
deleted
… advanced mode/update FeedbackRating component to accept Notice & Illustration components/updated snapshots
| const { styles, Children } = this.asProps; | ||
|
|
||
| const advancedMode = isAdvanceMode(Children, [ | ||
| NoticeFH.Label.displayName, |
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.
@ilyabrower idk, shall we check all inner component to enable advanced mode?
| Title: typeof Text; | ||
| Text: typeof Text; | ||
| Close: typeof Button; | ||
| /** |
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.
should be added as well just to preserve the same type as Notice has
Changelog
@semcore/feedback-form
Added
illustrationElement,NoticeComponentforFeedbackRatingcomponent.@semcore/feature-highlight
Added
Notice.Motivation and Context
How has this been tested?
Screenshots (if appropriate):
Types of changes
Checklist: