From cdd41adf3857ebfca9a3d079051865fbe2aa8b83 Mon Sep 17 00:00:00 2001 From: Arturo Date: Tue, 30 May 2023 17:06:21 +0200 Subject: [PATCH] feat(telekom-nav-flyout): implement backdrop --- .../telekom-nav-flyout/telekom-nav-flyout.css | 33 +++++++++++++++++-- .../telekom-nav-flyout/telekom-nav-flyout.tsx | 8 ++++- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/packages/components/src/components/telekom/telekom-nav-flyout/telekom-nav-flyout.css b/packages/components/src/components/telekom/telekom-nav-flyout/telekom-nav-flyout.css index 5b86b0d562..32cf6c9350 100644 --- a/packages/components/src/components/telekom/telekom-nav-flyout/telekom-nav-flyout.css +++ b/packages/components/src/components/telekom/telekom-nav-flyout/telekom-nav-flyout.css @@ -16,10 +16,14 @@ --height: auto; --position: fixed; --background: var(--telekom-color-background-surface); + --background-variant-mobile: var(--telekom-color-background-canvas); + --background-backdrop: var(--telekom-color-background-canvas); --shadow: none; --z-index: 7; --duration: var(--telekom-motion-duration-transition); + --duration-backdrop-in: var(--telekom-motion-duration-animation); + --duration-backdrop-out: var(--telekom-motion-duration-immediate); --translate-x: 0; --translate-y: var(--telekom-spacing-unit-x1); --translate-z: 0; @@ -27,11 +31,11 @@ display: contents; } -[part~='mobile'] { +[part~='variant-mobile'] { --height: 100vh; --top: 0; --duration: 0; - --background: var(--telekom-color-background-canvas); + --background: var(--background-variant-mobile); } :host([debug]) [part~='base'] { @@ -57,6 +61,30 @@ display: block; } +[part~='backdrop'] { + display: none; + position: var(--position); + background-color: var(--telekom-color-background-backdrop); + top: var(--top); + left: var(--left); + width: var(--width); + height: 100vh; + animation-duration: var(--duration); +} + +/* no backdrop for "mobile" variant */ +[part~='backdrop'][part~='expanded']:not([part~='variant-mobile']) { + display: block; +} + +[part~='backdrop'][part~='expanded'][part~='in'] { + animation-duration: var(--duration-backdrop-in); +} + +[part~='backdrop'][part~='expanded'][part~='out'] { + animation-duration: var(--duration-backdrop-out); +} + @keyframes toggle { from { opacity: 0; @@ -75,6 +103,7 @@ [part~='out'] { animation-name: toggle; + animation-fill-mode: forwards; animation-direction: reverse; animation-timing-function: var(--telekom-motion-easing-exit); } diff --git a/packages/components/src/components/telekom/telekom-nav-flyout/telekom-nav-flyout.tsx b/packages/components/src/components/telekom/telekom-nav-flyout/telekom-nav-flyout.tsx index 39dbc51f73..ea0423b074 100644 --- a/packages/components/src/components/telekom/telekom-nav-flyout/telekom-nav-flyout.tsx +++ b/packages/components/src/components/telekom/telekom-nav-flyout/telekom-nav-flyout.tsx @@ -198,12 +198,18 @@ export class TelekomNavItem { return (
+
(this.expanded = false)} + >
); }