Add start of user/account menu
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
Willem Dantuma
2020-06-12 12:24:08 +02:00
parent 978cbdabfc
commit c1c0bd2596
8 changed files with 77 additions and 2 deletions

View File

@@ -0,0 +1,3 @@
<div *ngIf="user">
<span class="rounded-circle menu-button" [title]="user.name">{{getLetter()}}</span>
</div>

View File

@@ -0,0 +1,10 @@
.menu-button {
background-color: purple;
color:white;
display: inline-block;
width: 2.5em;
height: 2.5em;
line-height: 2.5em;
text-align: center;
font-size: 1rem;
}

View File

@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { UserMenuComponent } from './user-menu.component';
describe('UserMenuComponent', () => {
let component: UserMenuComponent;
let fixture: ComponentFixture<UserMenuComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ UserMenuComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(UserMenuComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,21 @@
import { Component, OnInit,Input } from '@angular/core';
import { IUser } from '../../models/user';
@Component({
selector: 'fm-user-menu',
templateUrl: './user-menu.component.html',
styleUrls: ['./user-menu.component.scss']
})
export class UserMenuComponent implements OnInit {
@Input() user:IUser;
constructor() { }
ngOnInit(): void {
}
getLetter():string {
return this.user.name ? this.user.name.substr(0,1).toUpperCase():"";
}
}