diff --git a/README.md b/README.md index cbe2fe2..5be3175 100644 --- a/README.md +++ b/README.md @@ -171,6 +171,29 @@ If set to a valid absolute or relative URL, it will render an extra 'learn more' ![output with link](http://i.imgur.com/0nvb6sP.png) +### awsomeCloseIcon + +Font Awsome is required in your header for this feature to work. + +```html + +``` + + + + +| Type | Default value | +| --- | --- | +| string | null | + +If set to a Font awsome Icon e.g. "fa-window-close" it will replace the standard SVG with the Font awsome Icon. + +###### Example + +```html + +``` + ### target | Type | Default value | diff --git a/demo/app.component.ts b/demo/app.component.ts index c7ea46c..bb69328 100644 --- a/demo/app.component.ts +++ b/demo/app.component.ts @@ -32,7 +32,7 @@ import { - + `, styles: [` a.link { diff --git a/demo/index.html b/demo/index.html index 0f31afb..a8f7b54 100644 --- a/demo/index.html +++ b/demo/index.html @@ -8,6 +8,9 @@ angular2-cookie-law demo app + + + diff --git a/src/cookie-law-element.component.ts b/src/cookie-law-element.component.ts index 9072e1c..63787f0 100644 --- a/src/cookie-law-element.component.ts +++ b/src/cookie-law-element.component.ts @@ -43,11 +43,17 @@ export class CookieLawElementComponent implements OnInit { public transition: CookieLawAnimation; @Input() - get learnMore() { return this._learnMore; } + get learnMore() { return this._learnMore; } set learnMore(value: string) { this._learnMore = (value !== null && `${value}` !== 'false') ? value : null; } + @Input() + get awsomeCloseIcon() { return this._awsomeCloseIcon; } + set awsomeCloseIcon(value: string) { + this._awsomeCloseIcon = (value !== null && `${value}` !== 'false') ? value : null; + } + @Input() get target() { return this._target; } set target(value: CookieLawTarget) { @@ -70,6 +76,7 @@ export class CookieLawElementComponent implements OnInit { public noopener: boolean; private _learnMore: string; + private _awsomeCloseIcon: string; private _target: CookieLawTarget; private _position: CookieLawPosition; @@ -82,10 +89,17 @@ export class CookieLawElementComponent implements OnInit { } public ngOnInit(): void { - this.noopener = this._target === '_blank'; + this.noopener = this._target === '_blank'; this.transition = this.position === 'bottom' ? 'bottomIn' : 'topIn'; - this.closeSvg = this.domSanitizer.bypassSecurityTrustHtml(closeIcon); + if(this._awsomeCloseIcon){ + this.closeSvg = this.domSanitizer.bypassSecurityTrustHtml(""); + }else{ + this.closeSvg = this.domSanitizer.bypassSecurityTrustHtml(closeIcon); + } + + + this.currentStyles = { 'top': this.position === 'top' ? '0' : null, diff --git a/src/cookie-law.component.ts b/src/cookie-law.component.ts index 480e287..df68b94 100644 --- a/src/cookie-law.component.ts +++ b/src/cookie-law.component.ts @@ -28,6 +28,7 @@ import { selector: 'cookie-law', template: ` (); @@ -63,7 +67,7 @@ export class CookieLawComponent implements OnInit { return this._service.seen(this.name); } - constructor (private _service: CookieLawService) { + constructor(private _service: CookieLawService) { this.name = 'cookieLawSeen'; // set a default cookie name if not provided }