Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Header scss optimisation #3050

Merged
merged 2 commits into from
Jan 19, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
189 changes: 83 additions & 106 deletions core/css/header.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* @copyright Copyright (c) 2017, John Molakvoæ (skjnldsv@protonmail.com)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need to include the original authors of the original file ;)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I included the most active ones.
There is 16, should I include all of them? Or should we remove the copyright header entirely?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not about most active ones: it's about actual contributors to this file

*
* @license GNU AGPL version 3 or any later version
*
*/

/* prevent ugly selection effect on accidental selection */

#header, #navigation, #expanddiv {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code-style wise these should be on separate lines, one per selector.

Expand Down Expand Up @@ -25,7 +32,6 @@
}

/* HEADERS ------------------------------------------------------------------ */

#body-user #header, #body-settings #header, #body-public #header {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, separate lines per selector for readability please. :)

position: fixed;
top: 0;
Expand All @@ -39,7 +45,6 @@
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also if you want to do this in the right way, please don't use "magical" values you should assign variables like this to z-index.
screen shot 2017-01-12 at 16 42 15

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variables will come after @Espina2
Please see the main scss pr!


/* LOGO and APP NAME -------------------------------------------------------- */

#nextcloud {
position: absolute;
top: 0;
Expand Down Expand Up @@ -88,6 +93,16 @@
padding-top: 18px;
padding-right: 10px;
}
/* show caret indicator next to logo to make clear it is tappable */
.icon-caret {
display: inline-block;
width: 12px;
height: 12px;
margin: 0;
margin-top: -21px;
padding: 0;
vertical-align: middle;
}
}

/* hover effect for app switcher label */
Copy link
Contributor

@Espina2 Espina2 Jan 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In here instead of repeating the code you why you don't use @extend?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you wish to extend exactly? There isn't that much similarity.

And extend is great amongst similar properties, but since we generate the css, we need to aim for a balance between readability and optimisation.

Expand Down Expand Up @@ -123,7 +138,6 @@
}

/* show appname next to logo */

.header-appname {
display: inline-block;
position: relative;
Expand All @@ -136,26 +150,14 @@
vertical-align: middle;
}

/* show caret indicator next to logo to make clear it is tappable */

#header .icon-caret {
display: inline-block;
width: 12px;
height: 12px;
margin: 0;
margin-top: -21px;
padding: 0;
vertical-align: middle;
}

/* do not show menu toggle on public share links as there is no menu */

#body-public #header .icon-caret {
display: none;
}

/* NAVIGATION --------------------------------------------------------------- */

#navigation {
position: fixed;
top: 45px;
Expand All @@ -170,6 +172,7 @@
border-top-left-radius: 0;
border-top-right-radius: 0;
display: none;
box-sizing: border-box;
/*overflow-y: auto;
overflow-x: hidden;*/
z-index: 2000;
Expand All @@ -185,37 +188,8 @@
border-bottom-color: rgba(255, 255, 255, 0.97);
border-width: 10px;
margin-left: -10px;
left: 47%;
}
}

/* arrow look */

#expanddiv:after {
bottom: 100%;
border: solid transparent;
content: ' ';
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-color: rgba(0, 0, 0, 0);
border-bottom-color: rgba(255, 255, 255, 0.97);
border-width: 10px;
margin-left: -10px;
}

/* position of dropdown arrow */

#navigation:after {
left: 47%;
}

#expanddiv:after {
right: 15px;
}

#navigation {
box-sizing: border-box;
* {
box-sizing: border-box;
}
Expand Down Expand Up @@ -245,7 +219,10 @@
-ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=50)';
opacity: .5;
}
&:hover svg, &:focus svg, &:hover span, &:focus span {
&:hover svg,
&:focus svg,
&:hover span,
&:focus span {
-ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=100)';
opacity: 1;
}
Expand All @@ -256,26 +233,30 @@
}
}
}
}

/* icon opacity and hover effect */

#apps-management a {
&:hover svg, &:focus svg, &.active svg, &:hover span, &:focus span, &.active span {
-ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=100)';
opacity: 1;
.app-icon {
margin: 0 auto;
padding: 0;
max-height: 32px;
max-width: 32px;
}
/* loading feedback for apps */
.app-loading {
.icon-loading-dark {
display: inline !important;
position: absolute;
top: 20px;
left: 24px;
width: 32px;
height: 32px;
}
.app-icon {
-ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=0)';
opacity: 0;
}
}
}

#navigation .app-icon {
margin: 0 auto;
padding: 0;
max-height: 32px;
max-width: 32px;
}

/* Apps management */

#apps-management {
min-height: initial;
height: initial;
Expand All @@ -285,23 +266,16 @@
-ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=30)';
opacity: .3;
}
}
}

/* loading feedback for apps */

#navigation .app-loading {
.icon-loading-dark {
display: inline !important;
position: absolute;
top: 20px;
left: 24px;
width: 32px;
height: 32px;
}
.app-icon {
-ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=0)';
opacity: 0;
/* icon opacity and hover effect */
&:hover svg,
&:focus svg,
&.active svg,
&:hover span,
&:focus span,
&.active span {
-ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=100)';
opacity: 1;
}
}
}

Expand All @@ -313,7 +287,6 @@
/* USER MENU -----------------------------------------------------------------*/

/* info part on the right, used e.g. for info on who shared something */

.header-right {
position: absolute;
right: 0;
Expand All @@ -325,21 +298,6 @@
box-sizing: border-box;
}

/* Profile picture in header */

#header .avatardiv {
float: left;
display: inline-block;
margin-right: 8px;
cursor: pointer;
height: 32px;
width: 32px;
img {
opacity: 1;
cursor: pointer;
}
}

#settings {
float: right;
color: #ddd;
Expand All @@ -352,6 +310,7 @@
}
}

/* User menu on the right */
#expand {
display: block;
padding: 7px 30px 6px 10px;
Expand All @@ -374,6 +333,24 @@
.icon-caret {
margin-top: 0;
}

/* Profile picture in header */
.avatardiv {
float: left;
display: inline-block;
margin-right: 8px;
cursor: pointer;
height: 32px;
width: 32px;
img {
opacity: 1;
cursor: pointer;
}
/* do not show display name when profile picture is present */
&.avatardiv-shown + #expandDisplayName {
display: none;
}
}
}

#expanddiv {
Expand All @@ -389,8 +366,19 @@
border-top-right-radius: 0;
box-sizing: border-box;
&:after {
/* position of dropdown arrow */
right: 15px;
border-color: rgba(0, 0, 0, 0);
border-bottom-color: rgba(255, 255, 255, 1);
bottom: 100%;
border: solid transparent;
content: ' ';
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-width: 10px;
margin-left: -10px;
}
a {
display: block;
Expand All @@ -410,14 +398,3 @@
}
}
}

/* do not show display name when profile picture is present */

#header {
.avatardiv.avatardiv-shown + #expandDisplayName {
display: none;
}
#expand {
display: block;
}
}