-
Notifications
You must be signed in to change notification settings - Fork 41
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
feat: add inline notification component #301
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Max You <[email protected]>
👷 Deploy request for carbon-components-builder pending review.Visit the deploys page to approve it
|
Signed-off-by: Max You <[email protected]>
Signed-off-by: Max You <[email protected]>
Signed-off-by: Max You <[email protected]>
Signed-off-by: Max You <[email protected]>
Signed-off-by: Max You <[email protected]>
Verified that the component features and export works. |
Signed-off-by: Max You <[email protected]>
Signed-off-by: Max You <[email protected]>
…notification_clean
Signed-off-by: Max You <[email protected]>
699b295
to
b297629
Compare
Signed-off-by: Max You <[email protected]>
Signed-off-by: Max You <[email protected]>
…on-ui-builder into notification_clean
Signed-off-by: Max You <[email protected]>
Signed-off-by: Max You <[email protected]>
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.
-
notification and toast are separate components in both implementations, why stuff them into the same component here?
-
styling with the ternary operators is all over the place
id: string; | ||
type: string; | ||
lowContrast?: boolean; | ||
hideCloseButton?: boolean; |
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.
property name that sounds like a function
...commonSlots, | ||
...slotsDisabled, | ||
lowContrast: 'boolean', | ||
isLowContrast: (state: NotificationState) => ({ |
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.
naming
link: 'string', | ||
subtitleText: 'string', | ||
linkText: 'string', |
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.
link vs linkText... might need clearer naming
linkText: 'string', | ||
title: 'string', | ||
iconDescription: 'string', | ||
captionText: 'string' |
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.
why not just caption?
state.variant === 'toastNotification' | ||
? <ToastNotification | ||
className={state.cssClasses?.map((cc: any) => cc.id).join(' ')} | ||
onClick={() => { | ||
sendSignal(state.id, 'click'); | ||
}} | ||
onChange={(event: any) => { | ||
sendSignal(state.id, 'valueChange', [event.value], { ...state, value: event.value }); | ||
}} | ||
caption={state.captionText} | ||
iconDescription={state.iconDescription} | ||
hideCloseButton={state.hideCloseButton} | ||
lowContrast={state.lowContrast} | ||
kind={state.kind} | ||
subtitle={state.subtitleText} | ||
timeout={0} | ||
title={state.title} /> | ||
: <InlineNotification | ||
className={state.cssClasses?.map((cc: any) => cc.id).join(' ')} | ||
kind={state.kind} | ||
iconDescription={state.iconDescription} | ||
subtitle= {state.subtitleText} | ||
title={state.title} /> |
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.
indentation
selectedComponent.variant === 'toastNotification' && <TextInput | ||
light | ||
value={selectedComponent.captionText} | ||
labelText='Caption text' | ||
onChange={(event: any) => setComponent({ | ||
...selectedComponent, | ||
captionText: event.currentTarget.value | ||
})} /> |
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.
indentation and styling
componentObj.variant === 'toastNotification' | ||
? <ToastNotification | ||
className={cx(preventCheckEventStyle, componentObj.cssClasses?.map((cc: any) => cc.id).join(' '))} | ||
caption={componentObj.captionText} | ||
hideCloseButton={componentObj.hideCloseButton} | ||
lowContrast={componentObj.lowContrast} | ||
kind={componentObj.kind} | ||
subtitle={componentObj.subtitleText} | ||
timeout={0} | ||
title={componentObj.title} /> | ||
: <InlineNotification | ||
className={cx(preventCheckEventStyle, componentObj.cssClasses?.map((cc: any) => cc.id).join(' '))} | ||
kind={componentObj.kind} | ||
hideCloseButton={componentObj.hideCloseButton} | ||
lowContrast={componentObj.lowContrast} | ||
subtitle={componentObj.subtitleText} | ||
title={componentObj.title} /> |
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.
indentation
? `<cds-toast | ||
${angularClassNamesFromComponentObj(json)} | ||
[notificationObj]="${nameStringToVariableString(json.codeContext?.name)}notificationObj"> | ||
</cds-toast>` | ||
: `<cds-inline-notification | ||
${angularClassNamesFromComponentObj(json)} | ||
[notificationObj]="${nameStringToVariableString(json.codeContext?.name)}notificationObj"> | ||
</cds-inline-notification>` |
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.
indentation
${json.variant === 'toastNotification' ? | ||
`caption: "${json.captionText ? json.captionText : ''}",` : `message: "${json.captionText ? json.captionText : ''}",`} | ||
lowContrast:${json.lowContrast ? json.lowContrast : false}, | ||
showClose: ${!json.hideCloseButton} |
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.
hard to read
Signed-off-by: Max You <[email protected]>
Co-authored-by: Zvonimir Fras <[email protected]>
Signed-off-by: Max You <[email protected]>
…on-ui-builder into notification_clean
Signed-off-by: Max You <[email protected]>
Signed-off-by: Max You <[email protected]>
Signed-off-by: Max You <[email protected]>
Signed-off-by: Max You <[email protected]>
Signed-off-by: Max You <[email protected]>
Signed-off-by: Max You <[email protected]>
Signed-off-by: Max You <[email protected]>
Signed-off-by: Max You <[email protected]>
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 it be notification
instead of inline-notification
? 🤔
cc: @Akshat55
sdk/react/src/lib/fragment-components/a-inline-notification.tsx
Outdated
Show resolved
Hide resolved
sdk/react/src/lib/fragment-components/a-inline-notification.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Zvonimir Fras <[email protected]>
Signed-off-by: Max You <[email protected]>
…on-ui-builder into notification_clean
Signed-off-by: Max You <[email protected]>
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 subtitle
be caption
?
sdk/react/src/lib/fragment-components/a-inline-notification.tsx
Outdated
Show resolved
Hide resolved
sdk/react/src/lib/fragment-components/a-inline-notification.tsx
Outdated
Show resolved
Hide resolved
sdk/react/src/lib/fragment-components/a-inline-notification.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Zvonimir Fras <[email protected]>
Co-authored-by: Zvonimir Fras <[email protected]>
no |
Signed-off-by: Max You <[email protected]>
please explain |
for #159