From 22e4705a9cde1ec45fac032721af6d47ef60566b Mon Sep 17 00:00:00 2001 From: Indrajith K L Date: Mon, 18 Dec 2017 17:02:00 +0530 Subject: initial commit --- src/vanilla.yo.notification.ts | 76 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 src/vanilla.yo.notification.ts (limited to 'src/vanilla.yo.notification.ts') diff --git a/src/vanilla.yo.notification.ts b/src/vanilla.yo.notification.ts new file mode 100644 index 0000000..7b50804 --- /dev/null +++ b/src/vanilla.yo.notification.ts @@ -0,0 +1,76 @@ +// Import stylesheets +import './styles/style.css'; +import { Config } from './config.interface'; + +export default class VanillaYoNotification { + + private notificationTemplate: string; + private defaultConfig: Config; + private notifInner: any; + + constructor() { + this.defaultConfig = { + content: '', + footer: '', + timeout: 3000, + title: '' + } + this.init(); + } + + private init() { + + this.buildContainers(); + + + } + + buildContainers(){ + let container = document.createElement('div'); + container.className = "notif-mainContainer topRight"; + + this.notifInner = document.createElement('div'); + this.notifInner.className = "notif-inner"; + + container.appendChild(this.notifInner); + document.body.appendChild(container); + } + + + show(config: Config) { + + let notifContainer = document.createElement('div'); + notifContainer.className = "vanilla-yo-notification"; + + + this.notificationTemplate = ` +