Skip to content

Commit

Permalink
fix(shadow): replace setClassName to updateRootClass
Browse files Browse the repository at this point in the history
  • Loading branch information
alyleui committed Apr 11, 2018
1 parent cc2d58e commit 6a59ec2
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions src/lib/shadow/deep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class LyDeepComponent implements OnInit {
private _result: string;
private numberState = -1;
private _shadowColor = 'rgba(0,0,0,0.87)';
private _classId: string;
private _lastClass: string;
/** Default elevation */
private elevation: string | number = 1;
@HostBinding('style.box-shadow') styleBoxShadow: SafeStyle | string;
Expand All @@ -44,8 +44,8 @@ export class LyDeepComponent implements OnInit {
elevation = this.elevation;
}
const newStyle = this.theme.createStyle(`ly-${keys}`, this.css.bind(this), elevation, color);
this.setClassName(newStyle.id, this._classId);
this._classId = keys;
this.theme.updateRootClass(this.elementRef, this.renderer, newStyle.id, this._lastClass);
this._lastClass = keys;
}

@Input('shadowColor')
Expand All @@ -58,19 +58,10 @@ export class LyDeepComponent implements OnInit {
}
constructor(
private elementRef: ElementRef,
private shadow: LyShadowService,
private renderer: Renderer2,
private theme: LyTheme,
private renderer: Renderer2
) {

}

setClassName(newClass: string, oldClass?: string) {
this.renderer.addClass(this.elementRef.nativeElement, newClass);
if (oldClass) {
this.renderer.removeClass(this.elementRef.nativeElement, oldClass);
}
}
private shadow: LyShadowService
) { }

ngOnInit() {
// console.log('slect', this.styleSheet.existStyle(''));
Expand Down

0 comments on commit 6a59ec2

Please sign in to comment.