-
Notifications
You must be signed in to change notification settings - Fork 2
Added custom notification support #21
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
Added custom notification support #21
Conversation
|
add CHANGELOG |
| styleUrl: 'custom-create-toast.css', | ||
| shadow: true, | ||
| }) | ||
| export class CustomToast { |
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.
rename file to custom-toast (match file name with component name)
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.
done
| } | ||
|
|
||
| private initializeToast(container: HTMLElement) { | ||
| if (container && !container.hasChildNodes()) { |
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.
do early return
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.
done
| styleUrl: 'simple-toast.css', | ||
| shadow: true, | ||
| }) | ||
| export class TransactionToastContent { |
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.
either change file name or component name to match each other
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.
done
| @Event() handleDeleteToast: EventEmitter<void>; | ||
|
|
||
| render() { | ||
| const { icon, iconClassName, title, message, subtitle: notificationStatus } = this.toast; |
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.
notificationStatus no need, keep using subtitle
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.
done
|
|
||
| <button onClick={() => this.handleDeleteToast.emit()} type="button" class="icon-close" innerHTML={getIconHtmlFromIconDefinition(faTimes)}></button> | ||
|
|
||
| {notificationStatus && <div class="status-title">{notificationStatus}</div>} |
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.
class="status-title" --> class="subtitle"
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.
done
| @Event() handleDeleteToast: EventEmitter<string>; | ||
|
|
||
| render() { | ||
| if (this.toast.instantiateToastElement) { |
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.
typeof this.toast.instantiateToastElement === function
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 change it to check for the element
| @Component({ | ||
| tag: 'custom-toast', | ||
| }) | ||
| export class CustomToast { |
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 rename this to GenericToast
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.
done
|
|
||
| render() { | ||
| if (this.toast.instantiateToastElement) { | ||
| return <custom-create-toast toast={this.toast as IComponentToastType} onHandleDeleteToast={() => this.handleDeleteToast.emit(this.toast.toastId)} />; |
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 rename this to CustomToast
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.
done
| @@ -0,0 +1,66 @@ | |||
| import { IconName } from '@fortawesome/free-solid-svg-icons'; | |||
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.
Add comment on top of file
// match these interfaces with src/path-to-file.type.ts from sdk-dapp
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.
done
| export class ToastList { | ||
| private eventBus: IEventBus = new EventBus(); | ||
| @Prop() transactionToasts: ITransactionToast[]; | ||
| @Prop() customToasts: ICustomToastType[]; |
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.
ICustomToast
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.
done
Issue/Feature
Added custom notification support
[] Yes
Updated CHANGELOG
[x] Yes
Testing
[x] User testing
[] Unit tests