Skip to content
Snippets Groups Projects
Commit eb01771a authored by Bastien DUMONT's avatar Bastien DUMONT :angel:
Browse files

chore(ui): remove tooltip from svg-icon

parent 0d0c4347
Branches
Tags
2 merge requests!783V3.0.0,!664chore(ui): remove tooltip from svg-icon
......@@ -13,15 +13,15 @@
<div class="mobile-column">
<div fxLayout="column" fxFlex="100%">
<div *ngIf="structure.address" fxLayout="row" fxLayoutAlign="none center" fxLayoutGap="13px">
<app-svg-icon [type]="'ico'" [icon]="'adress'" [title]="'Adresse'" [iconClass]="'icon-22'" />
<app-svg-icon [type]="'ico'" [icon]="'adress'" [iconClass]="'icon-22'" />
<p>{{ structure.address.numero }} {{ structure.address.street }}, {{ structure.address.commune }}</p>
</div>
<div *ngIf="structure.contactPhone" fxLayout="row" fxLayoutAlign="none center" fxLayoutGap="13px">
<app-svg-icon [type]="'ico'" [icon]="'tel'" [title]="'Téléphone'" [iconClass]="'icon-22'" />
<app-svg-icon [type]="'ico'" [icon]="'tel'" [iconClass]="'icon-22'" />
<p>{{ structure.contactPhone | phone }}</p>
</div>
<div *ngIf="structure.contactMail" fxLayout="row" fxLayoutAlign="none center" fxLayoutGap="13px">
<app-svg-icon [type]="'ico'" [iconClass]="'grey-1 icon-22'" [icon]="'email'" [title]="'Email'" />
<app-svg-icon [type]="'ico'" [iconClass]="'grey-1 icon-22'" [icon]="'email'" />
<p>{{ structure.contactMail }}</p>
</div>
</div>
......
<div appTooltipDirective title="{{ title }}">
<ng-template #tooltipTemplate>
<div class="tooltip">{{ title }}</div>
</ng-template>
<div>
<svg
aria-hidden="true"
class="icon"
......
......@@ -14,5 +14,4 @@ export class SvgIconComponent {
@Input() iconClass: string;
@Input() iconColor = 'none';
@Input() title: string = null;
}
import {
ContentChild,
Directive,
ElementRef,
HostListener,
Input,
Renderer2,
TemplateRef,
ViewContainerRef,
} from '@angular/core';
@Directive({ selector: '[appTooltipDirective]' })
export class TooltipDirective {
@Input() title: string;
constructor(
private renderer: Renderer2,
private elementRef: ElementRef,
private viewContainerRef: ViewContainerRef
) {}
@Input() parametroPlantilla: TemplateRef<any>;
@ContentChild('tooltipTemplate') private tooltipTemplateRef: TemplateRef<object>;
@HostListener('mouseenter') onMouseEnter(): void {
if (this.title && this.title.length > 0) {
const view = this.viewContainerRef.createEmbeddedView(this.tooltipTemplateRef);
view.rootNodes.forEach((node) => this.renderer.appendChild(this.elementRef.nativeElement, node));
}
}
@HostListener('mouseleave') onMouseLeave(): void {
if (this.viewContainerRef) {
this.viewContainerRef.clear();
}
}
}
import { TooltipDirective } from '../components/tooltip/tooltip.directive';
import { ModalOutsideDirective } from './modalOutside.directive';
export { ModalOutsideDirective };
export const SharedDirectives = [ModalOutsideDirective, TooltipDirective];
export const SharedDirectives = [ModalOutsideDirective];
......@@ -492,10 +492,6 @@ button {
margin: 0 auto;
}
[appTooltipDirective] {
position: relative;
}
.tooltip {
position: absolute;
bottom: 100%;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment