Merge pull request #4139 from JohnONolan/dropdown-refresh

Updated dropdown component style
This commit is contained in:
Paul Davis 2014-09-24 12:19:58 +01:00
commit d87980b80a
4 changed files with 40 additions and 206 deletions

View File

@ -33,7 +33,7 @@
z-index: 1000;
display: none; // none by default, but block on "open" of the menu
float: left;
min-width: 160px;
min-width: 220px;
padding: 5px 0;
margin: 2px 0 0; // override default ul
list-style: none;
@ -43,8 +43,8 @@
letter-spacing: 0;
text-align: left; // Ensures proper alignment if parent has it changed (e.g., modal footer)
background-color: #fff;
border: #B0BEC4 1px solid;
border-radius: $rounded;
border: darken($lightgrey, 15%) 1px solid;
border-radius: 2px;
box-shadow: rgba(0,0,0,0.175) 0 2px 6px;
background-clip: padding-box;
@ -59,9 +59,9 @@
// Dividers (basically an hr) within the dropdown
.divider {
height: 1px;
margin: 9px 0;
margin: 4px 0;
overflow: hidden;
background: #D0DADE;
background: darken($lightgrey, 5%);
}
// Links within the dropdown menu
@ -72,11 +72,16 @@
padding: 3px 20px;
clear: both;
font-weight: normal;
line-height: 1.428571429;
line-height: 1.9em;
text-align: left;
color: #333;
white-space: nowrap; // prevent links from randomly breaking onto new lines
}
i {
font-size: 0.9em;
margin-right: 0.5rem;
}
}
// Hover/Focus state
@ -250,7 +255,7 @@
top: -$dropdown_triangle;
}
&:after {
@include triangle(($dropdown_triangle * 2) + 2, #B0BEC4, up);
@include triangle(($dropdown_triangle * 2) + 2, darken($lightgrey, 15%), up);
top: -($dropdown_triangle + 1);
}
}
@ -260,7 +265,7 @@
bottom: -$dropdown_triangle;
}
&:after {
@include triangle(($dropdown_triangle * 2) + 2, #B0BEC4, down);
@include triangle(($dropdown_triangle * 2) + 2, darken($lightgrey, 15%), down);
bottom: -($dropdown_triangle + 1);
}
}
@ -325,4 +330,4 @@
@extend %dropdown-triangle;
@extend %dropdown-triangle-bottom;
@extend %dropdown-triangle-right;
}
}

View File

@ -1,176 +0,0 @@
//
// Dropdown Styles
// --------------------------------------------------
// Wrapper
// Does nothing yet...
.dropdown {}
// List
.dropdown-menu {
position: relative;
display: inline-block;
min-width: 160px;
padding: 0.5rem 0;
margin: 0;
font-size: 1.4rem;
line-height: 1;
font-weight: normal;
text-transform: none;
letter-spacing: 0;
background: #fff;
border: #B0BEC4 1px solid;
box-shadow: rgba(0,0,0,0.175) 0 2px 6px;
border-radius: 2px;
// Item Resets - This means we can use any element
li {
list-style: none;
}
&:before {
content: '';
position: absolute;
border-style: solid;
border-color: #fff transparent;
display: block;
width: 0;
} // :before
&:after {
content: '';
position: absolute;
width: ($dropdown_triangle * 1.5);
height: ($dropdown_triangle * 1.5);
background: #B0BEC4;
transform: rotate(45deg);
z-index: -1;
} // :after
} // .dropdown-menu
.dropdown-triangle-top {
&:before {
border-width: 0 $dropdown_triangle $dropdown_triangle $dropdown_triangle;
top: -$dropdown_triangle;
}
&:after {
top: -($dropdown_triangle - 1);
}
}
.dropdown-triangle-bottom {
&:before {
border-width: $dropdown_triangle $dropdown_triangle 0 $dropdown_triangle;
bottom: -$dropdown_triangle;
}
&:after {
bottom: -($dropdown_triangle - 1);
}
}
.dropdown-triangle-center {
&:before {
left: 50%;
margin-left: -$dropdown_triangle;
}
&:after {
left: 50%;
margin-left: -($dropdown_triangle * 1.5 / 2);
}
}
// TODO: Make the values here use the $dropdown_triangle var
.dropdown-triangle-left {
&:before {
left: 10px;
}
&:after {
left: 12px;
}
}
.dropdown-triangle-right {
&:before {
left: auto;
right: 10px;
}
&:after {
left: auto;
right: 12px;
}
}
.dropdown-top {
@extend .dropdown-menu;
@extend .dropdown-triangle-center;
@extend .dropdown-triangle-top;
}
.dropdown-top-left {
@extend .dropdown-menu;
@extend .dropdown-triangle-top;
@extend .dropdown-triangle-left;
}
.dropdown-top-right {
@extend .dropdown-menu;
@extend .dropdown-triangle-top;
@extend .dropdown-triangle-right;
}
.dropdown-bottom {
@extend .dropdown-menu;
@extend .dropdown-triangle-center;
@extend .dropdown-triangle-bottom;
}
.dropdown-bottom-left {
@extend .dropdown-menu;
@extend .dropdown-triangle-bottom;
@extend .dropdown-triangle-left;
}
.dropdown-bottom-right {
@extend .dropdown-menu;
@extend .dropdown-triangle-bottom;
@extend .dropdown-triangle-right;
}
// List Item
.dropdown-item {
display: block;
width: 100%;
padding: 0.8rem 2rem;
font-size: 1.4rem;
line-height: 1;
color: #000;
&:not(.divider):hover,
&:not(.divider):focus {
color: #fff;
background: $blue;
}
} // .dropdown-item
// Divider
.dropdown-menu .divider {
display: block;
padding: 0;
margin: 0.9rem 0;
height: 1px;
width: 100%;
position: relative;
background: #D0DADE;
overflow: hidden;
} // .dropdown-menu .divider
// Icons
.dropdown-with-icons {
.dropdown-item:not(.divider) {
padding: 0.6rem 3rem;
&[class*='icon-'] {
position: relative;
&:before {
position: absolute;
top: 50%;
left: 1rem;
font-size: 1.2rem;
line-height: 1;
margin-top: -0.6rem;
}
} // &[class*='icon-']
} // .dropdown-item
} // .dropdown-with-icons

View File

@ -138,25 +138,24 @@
line-height: 11px;
}
}
&:hover .name {
color: rgba(255,255,255,0.9);
background: darken($darkgrey, 7%);
transition: background 0.1s;
}
i:before {
width: auto;
margin-left: 5px;
}
.dropdown {
position: absolute;
top: 100%;
right: 100%;
position: fixed;
top: 50px;
right: 15px;
left: auto;
.dropdown-menu {
position: absolute;
top: 0;
right: 0;
left: auto;
}
}
@ -284,11 +283,17 @@
}
}
.dropdown .dropdown-menu {
top: auto;
right: auto;
bottom: calc(100% + 80px);
left: 10px;
.dropdown {
position: absolute;
top: 100%;
right: 100%;
.dropdown-menu {
top: auto;
right: auto;
bottom: calc(100% + 80px);
left: 10px;
}
}
@ -308,4 +313,4 @@
}//.nav-cover
}//body.global-nav-expanded
}
}

View File

@ -3,7 +3,7 @@
<a class="nav-item ghost-logo" {{bind-attr href=ghostPaths.blogRoot title=ghostPaths.blogRoot}}>
<div class="nav-label"><i class="icon-ghost"></i> <span>Visit blog</span> </div>
</a>
{{#link-to "posts" classNames="nav-item nav-content js-nav-item"}}
<div class="nav-label"><i class="icon-content"></i> Content</div>
{{/link-to}}
@ -11,13 +11,13 @@
{{#link-to "editor.new" classNames="nav-item nav-new js-nav-item"}}
<div class="nav-label"><i class="icon-add"></i> New Post</div>
{{/link-to}}
{{#unless session.user.isAuthor}}
{{#link-to "settings" classNames="nav-item nav-settings js-nav-item"}}
<div class="nav-label"><i class="icon-settings2"></i> Settings</div>
{{/link-to}}
{{/unless}}
{{! TODO: Mobile-only menu items
<a class="nav-item thing" href="#">
@ -43,14 +43,14 @@
{{/gh-popover-button}}
{{#gh-popover tagName="div" classNames="dropdown" name="user-menu" closeOnClick="true"}}
<ul class="dropdown-menu dropdown-triangle-top-right js-user-menu-dropdown-menu" role="menu">
<li role="presentation">{{#link-to "settings.users.user" session.user.slug classNames="dropdown-item user-menu-profile js-nav-item" role="menuitem" tabindex="-1"}}Your Profile{{/link-to}}</li>
<li role="presentation"><a class="dropdown-item user-menu-support" role="menuitem" tabindex="-1" href="http://support.ghost.org/">Help / Support</a></li>
<li role="presentation">{{#link-to "settings.users.user" session.user.slug classNames="dropdown-item user-menu-profile js-nav-item" role="menuitem" tabindex="-1"}}<i class="icon-user"></i> Your Profile{{/link-to}}</li>
<li role="presentation"><a class="dropdown-item user-menu-support" role="menuitem" tabindex="-1" href="http://support.ghost.org/"><i class="icon-support"></i> Help / Support</a></li>
<li class="divider"></li>
<li role="presentation">{{#link-to "signout" classNames="dropdown-item user-menu-signout" role="menuitem" tabindex="-1"}}Sign Out{{/link-to}}</li>
<li role="presentation">{{#link-to "signout" classNames="dropdown-item user-menu-signout" role="menuitem" tabindex="-1"}}<i class="icon-power"></i> Sign Out{{/link-to}}</li>
</ul>
{{/gh-popover}}
</div>{{! .user-menu }}
</nav>{{! .global-nav }}
<div class="nav-cover js-nav-cover"></div>
<div class="nav-cover js-nav-cover"></div>