Skip to content
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

Open
wants to merge 35 commits into
base: main
Choose a base branch
from

Conversation

maxxyouu
Copy link
Contributor

@maxxyouu maxxyouu commented Feb 29, 2024

for #159

Signed-off-by: Max You <[email protected]>
Copy link

netlify bot commented Feb 29, 2024

👷 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 <[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]>
@maxxyouu
Copy link
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 <[email protected]>
Signed-off-by: Max You <[email protected]>
Signed-off-by: Max You <[email protected]>
Copy link
Member

@zvonimirfras zvonimirfras left a 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;
Copy link
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) => ({
Copy link
Member

@zvonimirfras zvonimirfras Jul 16, 2024

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
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
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
Member

Choose a reason for hiding this comment

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

indentation

sdk/react/src/lib/fragment-components/a-notification.tsx Outdated Show resolved Hide resolved
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
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
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
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
Member

Choose a reason for hiding this comment

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

hard to read

@maxxyouu maxxyouu 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 <[email protected]>
Signed-off-by: Max You <[email protected]>
Max You added 3 commits July 25, 2024 13:07
Signed-off-by: Max You <[email protected]>
Signed-off-by: Max You <[email protected]>
Copy link
Member

@zvonimirfras zvonimirfras left a 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

player/react/src/lib/components/index.ts Outdated Show resolved Hide resolved
sdk/react/src/lib/components/actions-connector.tsx Outdated Show resolved Hide resolved
sdk/react/src/lib/fragment-components/index.ts Outdated Show resolved Hide resolved
Copy link
Member

@zvonimirfras zvonimirfras left a 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?

@maxxyouu
Copy link
Contributor Author

Should subtitle be caption?

no

Signed-off-by: Max You <[email protected]>
@zvonimirfras
Copy link
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