-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(profile): make easter egg accessible
displays "huh" photo version when passing by the element again says a message about passing by again instead
- Loading branch information
Showing
4 changed files
with
75 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 19 additions & 2 deletions
21
src/app/about/profile-picture/profile-picture.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,34 @@ | ||
import { Component, Inject } from '@angular/core'; | ||
import { Component, HostBinding, Inject } from '@angular/core'; | ||
import { METADATA } from '../../common/injection-tokens'; | ||
import { Metadata } from '../../metadata'; | ||
|
||
@Component({ | ||
selector: 'app-profile-picture', | ||
templateUrl: './profile-picture.component.html', | ||
styleUrls: ['./profile-picture.component.scss'] | ||
styleUrls: ['./profile-picture.component.scss'], | ||
}) | ||
export class ProfilePictureComponent { | ||
protected realName: string = this.metadata.realName; | ||
protected _hasBeenFocused= false; | ||
|
||
public static HAS_BEEN_FOCUSED_ATTR = 'data-has-been-focused' | ||
|
||
@HostBinding(`attr.${ProfilePictureComponent.HAS_BEEN_FOCUSED_ATTR}`) public get hasBeenFocused() { | ||
return this._hasBeenFocused ? true : undefined | ||
} | ||
|
||
@HostBinding('attr.tabindex') public get tabIndex() { | ||
return this.hasBeenFocused ? 0 : -1 | ||
} | ||
|
||
@HostBinding('attr.aria-label') public ariaLabel = 'Profile picture' | ||
|
||
constructor( | ||
@Inject(METADATA) private metadata: Metadata, | ||
) { | ||
} | ||
|
||
onFocus() { | ||
this._hasBeenFocused = true | ||
} | ||
} |