BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
72538b5f
Commit
72538b5f
authored
Jul 24, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improvements to positioning of the dropdown
parent
4d2be5bb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
5 deletions
+22
-5
fly_out_nav.js
app/assets/javascripts/fly_out_nav.js
+8
-2
new_sidebar.scss
app/assets/stylesheets/new_sidebar.scss
+10
-1
fly_out_nav_spec.js
spec/javascripts/fly_out_nav_spec.js
+4
-2
No files found.
app/assets/javascripts/fly_out_nav.js
View file @
72538b5f
...
...
@@ -2,7 +2,8 @@ export const calculateTop = (boundingRect, outerHeight) => {
const
windowHeight
=
window
.
innerHeight
;
const
bottomOverflow
=
windowHeight
-
(
boundingRect
.
top
+
outerHeight
);
return
bottomOverflow
<
0
?
boundingRect
.
top
-
Math
.
abs
(
bottomOverflow
)
:
boundingRect
.
top
;
return
bottomOverflow
<
0
?
(
boundingRect
.
top
-
outerHeight
)
+
boundingRect
.
height
:
boundingRect
.
top
;
};
export
default
()
=>
{
...
...
@@ -13,10 +14,15 @@ export default () => {
if
(
$subitems
.
length
)
{
const
boundingRect
=
$this
.
getBoundingClientRect
();
const
top
=
calculateTop
(
boundingRect
,
$subitems
.
outerHeight
());
const
isAbove
=
top
<
boundingRect
.
top
;
$subitems
.
css
({
transform
:
`translate3d(0,
${
top
}
px, 0)`
,
});
if
(
isAbove
)
{
$subitems
.
addClass
(
'is-above'
);
}
}
}).
on
(
'mouseout'
,
e
=>
$
(
'.sidebar-sub-level-items'
,
e
.
currentTarget
).
hide
());
}).
on
(
'mouseout'
,
e
=>
$
(
'.sidebar-sub-level-items'
,
e
.
currentTarget
).
hide
()
.
removeClass
(
'is-above'
)
);
};
app/assets/stylesheets/new_sidebar.scss
View file @
72538b5f
...
...
@@ -215,9 +215,18 @@ $new-sidebar-width: 220px;
position
:
absolute
;
top
:
44px
;
left
:
-30px
;
right
:
0
;
bottom
:
0
;
height
:
100%
;
max-height
:
150px
;
width
:
300px
;
z-index
:
-1
;
transform
:
skew
(
33deg
);
}
&.
is-above
:
:
after
{
top
:
auto
;
bottom
:
44px
;
transform
:
skew
(
-30deg
);
}
a
{
...
...
spec/javascripts/fly_out_nav_spec.js
View file @
72538b5f
...
...
@@ -5,6 +5,7 @@ describe('Fly out sidebar navigation', () => {
it
(
'returns boundingRect top'
,
()
=>
{
const
boundingRect
=
{
top
:
100
,
height
:
100
,
};
expect
(
...
...
@@ -14,12 +15,13 @@ describe('Fly out sidebar navigation', () => {
it
(
'returns boundingRect - bottomOverflow'
,
()
=>
{
const
boundingRect
=
{
top
:
window
.
innerHeight
,
top
:
window
.
innerHeight
-
50
,
height
:
100
,
};
expect
(
calculateTop
(
boundingRect
,
100
),
).
toBe
(
window
.
innerHeight
-
10
0
);
).
toBe
(
window
.
innerHeight
-
5
0
);
});
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment