Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
design-system-lib
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
julkiset-sivut
design-system-lib
Commits
e728280a
Commit
e728280a
authored
4 years ago
by
druid
Browse files
Options
Downloads
Patches
Plain Diff
hide backdrop when browser size is exiting fullscreen into <1200px screen size
parent
972897be
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/site-header/hy-desktop-menu-links/hy-desktop-menu-links.tsx
+18
-0
18 additions, 0 deletions
...te-header/hy-desktop-menu-links/hy-desktop-menu-links.tsx
with
18 additions
and
0 deletions
src/components/site-header/hy-desktop-menu-links/hy-desktop-menu-links.tsx
+
18
−
0
View file @
e728280a
...
...
@@ -20,6 +20,7 @@ export interface DesktopLinks {
import
{
ColorVariant
}
from
'
../../../utils/utils
'
;
import
{
Component
,
h
,
Element
,
Prop
,
State
,
Watch
,
EventEmitter
,
Event
,
Listen
}
from
'
@stencil/core
'
;
import
ResizeObserver
from
'
resize-observer-polyfill
'
;
@
Component
({
tag
:
'
hy-desktop-menu-links
'
,
...
...
@@ -47,6 +48,8 @@ export class HyDesktopMenuLinks {
private
_hoverTimer
=
null
;
private
_fadeOutTimer
=
null
;
private
ro
:
ResizeObserver
;
@
Watch
(
'
dataDesktopLinks
'
)
dataDesktopLinksWatcher
(
data
:
DesktopLinks
[]
|
string
)
{
this
.
_dataDesktopLinks
=
typeof
data
===
'
string
'
?
JSON
.
parse
(
data
)
:
data
;
...
...
@@ -56,6 +59,13 @@ export class HyDesktopMenuLinks {
this
.
dataDesktopLinksWatcher
(
this
.
dataDesktopLinks
);
}
removeBackdropShadow
(
size
:
number
)
{
// Close backdrop shadow if the screen is < 1200px
if
(
size
<
1200
)
{
this
.
showBackdropShadow
();
}
}
showBackdropShadow
(
state
=
'
close
'
,
top
=
0
)
{
let
hyHeader
=
this
.
el
.
closest
(
'
.hy-site-header
'
)
as
HTMLElement
;
let
hyBackdropDiv
=
hyHeader
.
children
[
0
]
as
HTMLElement
;
...
...
@@ -288,6 +298,14 @@ export class HyDesktopMenuLinks {
}
componentDidLoad
()
{
// Set the browser resize observer to gather information about browser width.
this
.
ro
=
new
ResizeObserver
((
entries
)
=>
{
for
(
const
entry
of
entries
)
{
this
.
removeBackdropShadow
(
entry
.
contentRect
.
width
);
}
});
this
.
ro
.
observe
(
document
.
body
);
let
hyToolbar
=
document
.
querySelectorAll
(
'
#toolbar-administration
'
)[
0
];
if
(
hyToolbar
)
{
this
.
hasToolbar
=
true
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment