Skip to content

feat: add inline notification component#301

Open
jz5426 wants to merge 35 commits into
IBM:mainfrom
jz5426:notification_clean
Open

feat: add inline notification component#301
jz5426 wants to merge 35 commits into
IBM:mainfrom
jz5426:notification_clean

Conversation

@jz5426

@jz5426 jz5426 commented Feb 29, 2024

Copy link
Copy Markdown
Contributor

for #159

Signed-off-by: Max You <JianzhongMax.You@ibm.com>
@netlify

netlify Bot commented Feb 29, 2024

Copy link
Copy Markdown

👷 Deploy request for carbon-components-builder pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 06d5121

Max You added 5 commits February 29, 2024 14:45
Signed-off-by: Max You <JianzhongMax.You@ibm.com>
Signed-off-by: Max You <JianzhongMax.You@ibm.com>
Signed-off-by: Max You <JianzhongMax.You@ibm.com>
Signed-off-by: Max You <JianzhongMax.You@ibm.com>
Signed-off-by: Max You <JianzhongMax.You@ibm.com>
@jz5426

jz5426 commented Apr 18, 2024

Copy link
Copy Markdown
Contributor Author

Verified that the component features and export works.

Max You added 4 commits April 18, 2024 12:40
Signed-off-by: Max You <JianzhongMax.You@ibm.com>
Signed-off-by: Max You <JianzhongMax.You@ibm.com>
Signed-off-by: Max You <JianzhongMax.You@ibm.com>
@jz5426
jz5426 force-pushed the notification_clean branch from 699b295 to b297629 Compare May 10, 2024 14:08
Akshat55 and others added 6 commits May 29, 2024 18:56
Signed-off-by: Max You <JianzhongMax.You@ibm.com>
Max You Max You
fix
Signed-off-by: Max You <JianzhongMax.You@ibm.com>
Signed-off-by: Max You <JianzhongMax.You@ibm.com>
Signed-off-by: Max You <JianzhongMax.You@ibm.com>

@zvonimirfras zvonimirfras left a comment

Copy link
Copy Markdown
Member

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;

Copy link
Copy Markdown
Member

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) => ({

@zvonimirfras zvonimirfras Jul 16, 2024

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

naming

Comment on lines +62 to +64
link: 'string',
subtitleText: 'string',
linkText: 'string',

Copy link
Copy Markdown
Member

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'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just caption?

Comment on lines +83 to +105
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} />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation

Comment thread sdk/react/src/lib/fragment-components/a-notification.tsx Outdated
Comment on lines +100 to +107
selectedComponent.variant === 'toastNotification' && <TextInput
light
value={selectedComponent.captionText}
labelText='Caption text'
onChange={(event: any) => setComponent({
...selectedComponent,
captionText: event.currentTarget.value
})} />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation and styling

Comment on lines +139 to +155
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} />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation

Comment on lines +191 to +198
? `<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>`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation

Comment on lines +208 to +211
${json.variant === 'toastNotification' ?
`caption: "${json.captionText ? json.captionText : ''}",` : `message: "${json.captionText ? json.captionText : ''}",`}
lowContrast:${json.lowContrast ? json.lowContrast : false},
showClose: ${!json.hideCloseButton}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hard to read

Max You and others added 7 commits July 22, 2024 15:37
Signed-off-by: Max You <JianzhongMax.You@ibm.com>
Co-authored-by: Zvonimir Fras <zvonimir.fras@gmail.com>
Signed-off-by: Max You <JianzhongMax.You@ibm.com>
Signed-off-by: Max You <JianzhongMax.You@ibm.com>
Signed-off-by: Max You <JianzhongMax.You@ibm.com>
Max You Max You
svg
Signed-off-by: Max You <JianzhongMax.You@ibm.com>
@jz5426 jz5426 changed the title feat: add notification component feat: add inline notification component Jul 25, 2024
Max You added 2 commits July 25, 2024 13:05
Signed-off-by: Max You <JianzhongMax.You@ibm.com>
Signed-off-by: Max You <JianzhongMax.You@ibm.com>
Max You added 3 commits July 25, 2024 13:07
Signed-off-by: Max You <JianzhongMax.You@ibm.com>
Signed-off-by: Max You <JianzhongMax.You@ibm.com>
Signed-off-by: Max You <JianzhongMax.You@ibm.com>

@zvonimirfras zvonimirfras left a comment

Copy link
Copy Markdown
Member

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

Comment thread player/react/src/lib/components/index.ts Outdated
Comment thread sdk/react/src/lib/components/actions-connector.tsx
Comment thread sdk/react/src/lib/fragment-components/a-inline-notification.tsx Outdated
Comment thread sdk/react/src/lib/fragment-components/index.ts Outdated
Comment thread sdk/react/src/lib/fragment-components/a-inline-notification.tsx Outdated
jz5426 and others added 4 commits August 1, 2024 16:56
Co-authored-by: Zvonimir Fras <zvonimir.fras@gmail.com>
Signed-off-by: Max You <JianzhongMax.You@ibm.com>
Signed-off-by: Max You <JianzhongMax.You@ibm.com>

@zvonimirfras zvonimirfras left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should subtitle be caption?

Comment thread player/react/src/lib/components/ui-inline-notification.tsx Outdated
Comment thread sdk/react/src/lib/fragment-components/a-inline-notification.tsx Outdated
Comment thread sdk/react/src/lib/fragment-components/a-inline-notification.tsx Outdated
Comment thread sdk/react/src/lib/fragment-components/a-inline-notification.tsx Outdated
jz5426 and others added 2 commits August 12, 2024 13:54
Co-authored-by: Zvonimir Fras <zvonimir.fras@gmail.com>
Co-authored-by: Zvonimir Fras <zvonimir.fras@gmail.com>
@jz5426

jz5426 commented Aug 12, 2024

Copy link
Copy Markdown
Contributor Author

Should subtitle be caption?

no

Signed-off-by: Max You <JianzhongMax.You@ibm.com>
@zvonimirfras

Copy link
Copy Markdown
Member

Should subtitle be caption?

no

please explain

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

3 participants