From 5e25e9736fe7bab06e09d704900c6695e05f524d Mon Sep 17 00:00:00 2001 From: mastah Date: Wed, 28 Jan 2026 00:48:24 +0100 Subject: [PATCH] Added show/hide controls with animations and hover zone. --- src/app/app.module.ts | 4 ++ src/app/components/app/app.component.html | 32 +++++++-- src/app/components/app/app.component.scss | 82 +++++++++++++++++++++++ src/app/components/app/app.component.ts | 22 +++++- src/styles.scss | 7 +- 5 files changed, 140 insertions(+), 7 deletions(-) diff --git a/src/app/app.module.ts b/src/app/app.module.ts index fb04149..a5d2089 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -1,11 +1,13 @@ import { NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { BrowserModule } from '@angular/platform-browser'; +import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { AppComponent } from './components/app/app.component'; import { MatInputModule } from '@angular/material/input'; import { MatIconModule } from '@angular/material/icon'; import { ClipboardModule } from '@angular/cdk/clipboard'; import { MatSnackBarModule} from '@angular/material/snack-bar'; +import { MatButtonToggleModule } from '@angular/material/button-toggle'; import { TranslatePipe } from './translate-pipe'; import { PeselComponent } from './components/pesel/pesel.component'; import { NipComponent } from './components/nip/nip.component'; @@ -28,11 +30,13 @@ import { environment } from '../environments/environment'; ], imports: [ BrowserModule, + BrowserAnimationsModule, FormsModule, MatInputModule, MatIconModule, ClipboardModule, MatSnackBarModule, + MatButtonToggleModule, ReactiveFormsModule, NgOptimizedImage, ServiceWorkerModule.register('ngsw-worker.js', { diff --git a/src/app/components/app/app.component.html b/src/app/components/app/app.component.html index 78e1cab..dcdb62c 100644 --- a/src/app/components/app/app.component.html +++ b/src/app/components/app/app.component.html @@ -1,8 +1,30 @@
+
+@if (showControls) { +
+ + REGON + NIP + PESEL + DOWÓD + IBAN + +
+}
- - - - - + @if (showRegon) { + + } + @if (showNip) { + + } + @if (showPesel) { + + } + @if (showIdentityCard) { + + } + @if (showIban) { + + }
diff --git a/src/app/components/app/app.component.scss b/src/app/components/app/app.component.scss index e69de29..9e4b78f 100644 --- a/src/app/components/app/app.component.scss +++ b/src/app/components/app/app.component.scss @@ -0,0 +1,82 @@ +.hover-zone { + position: fixed; + top: 0; + left: 0; + right: 0; + height: 10px; + z-index: 9; +} + +.controls { + display: flex; + justify-content: center; + padding: 1em; + position: fixed; + top: 0; + left: 0; + right: 0; + z-index: 10; + animation: slideIn 300ms ease-out forwards; + + mat-button-toggle-group { + background: rgba(255, 255, 255, 0.15); + backdrop-filter: blur(10px); + border: 1px solid rgba(255, 255, 255, 0.2); + border-radius: 8px; + box-shadow: 0 4px 16px 0 rgba(0, 38, 135, 0.2); + overflow: hidden; + } + + mat-button-toggle { + color: white; + font-family: 'Comfortaa', sans-serif; + border-left: 1px solid rgba(255, 255, 255, 0.2) !important; + background-color: rgba(26, 35, 126, 0.4); + + &:first-child { + border-left: none !important; + } + + &.mat-button-toggle-checked { + background-color: rgba(255, 255, 255, 0.3); + color: white; + } + + &:hover { + background-color: rgba(255, 255, 255, 0.1); + } + } +} + +.generators { + padding-top: 2em; + + & > * { + display: block; + animation: fadeScaleIn 300ms ease-out forwards; + } +} + +@keyframes slideIn { + from { + transform: translateY(-100%); + opacity: 0; + } + to { + transform: translateY(0); + opacity: 1; + } +} + +@keyframes fadeScaleIn { + from { + opacity: 0; + transform: scale(0.9); + height: 0; + } + to { + opacity: 1; + transform: scale(1); + height: auto; + } +} diff --git a/src/app/components/app/app.component.ts b/src/app/components/app/app.component.ts index 3a7e28b..a13f133 100644 --- a/src/app/components/app/app.component.ts +++ b/src/app/components/app/app.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, HostListener } from '@angular/core'; @Component({ selector: 'app-root', @@ -8,9 +8,29 @@ import { Component, OnInit } from '@angular/core'; }) export class AppComponent implements OnInit { + showRegon = true; + showNip = true; + showPesel = true; + showIdentityCard = true; + showIban = true; + + showControls = false; + constructor() { } ngOnInit(): void { } + + @HostListener('window:mousemove', ['$event']) + onMouseMove(event: MouseEvent) { + // Show if mouse is in the top 20px (hover zone) + if (event.clientY < 20) { + this.showControls = true; + } + // Hide if mouse moves below 120px + else if (event.clientY > 120) { + this.showControls = false; + } + } } diff --git a/src/styles.scss b/src/styles.scss index 987429e..58a0759 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -3,6 +3,11 @@ src: url('assets/Comfortaa-VariableFont_wght.ttf'); } +html, body { + height: 100%; + overflow-y: hidden; +} + body { padding: 0; margin: 0; @@ -32,7 +37,7 @@ body { } .generator { - margin: 1em; + margin: 0 1em 2em 1em; background: rgba( 255, 255, 255, 0.15 ); box-shadow: 0 8px 32px 0 rgba( 0, 38, 135, 0.37 ); border-radius: 3px;