1
1
mirror of https://github.com/primer/css.git synced 2025-01-04 20:33:13 +03:00

add primer-support

This commit is contained in:
Shawn Allen 2017-08-30 13:31:47 -07:00 committed by Jon Rohan
parent 0838061136
commit 9b9d73b3da

View File

@ -0,0 +1,264 @@
// TODO add some docs here
@import "primer-support/index.scss";
.dropdown {
position: relative;
&.active {
.dropdown-menu-content {
display: block;
pointer-events: all;
}
}
}
.dropdown-caret {
display: inline-block;
width: 0;
height: 0;
vertical-align: middle;
content: "";
border: 4px solid;
border-right-color: transparent;
border-bottom-color: transparent;
border-left-color: transparent;
}
// Requires a positioning class (e.g., `.dropdown-menu-w`) to determine which
// way the menu should render from the element triggering it.
.dropdown-menu {
position: absolute;
top: 100%;
left: 0;
z-index: 100;
width: 160px;
padding-top: 5px;
padding-bottom: 5px;
margin-top: 2px;
list-style: none;
background-color: $bg-white;
background-clip: padding-box;
border: 1px solid $black-fade-15;
border-radius: 4px;
box-shadow: 0 3px 12px $black-fade-15;
&::before,
&::after {
position: absolute;
display: inline-block;
content: "";
}
&::before {
border: 8px solid transparent;
border-bottom-color: $black-fade-15;
}
&::after {
border: 7px solid transparent;
border-bottom-color: $white;
}
// stylelint-disable-next-line selector-max-type
> ul {
list-style: none;
}
}
.dropdown-menu-no-overflow {
width: auto;
.dropdown-item {
padding: 4px 15px;
overflow: visible;
text-overflow: inherit;
}
}
// Dropdown items (can be links or buttons)
.dropdown-item {
display: block;
padding: 4px 10px 4px 15px;
overflow: hidden;
color: $text-gray-dark;
text-overflow: ellipsis;
white-space: nowrap;
&:hover,
&.zeroclipboard-is-hover {
color: $text-white;
text-decoration: none;
background-color: $bg-blue;
> .octicon {
color: inherit;
opacity: 1;
}
}
&.btn-link {
width: 100%;
text-align: left;
}
}
.dropdown-signout {
width: 100%;
text-align: left;
background: none;
border: 0;
}
.dropdown-divider {
height: 1px;
margin: 8px 1px;
background-color: $gray-200;
}
.dropdown-header {
padding: 4px 15px;
font-size: 12px;
color: $text-gray;
}
.dropdown-menu-content {
display: none;
// stylelint-disable primer/selector-no-utility
&.anim-scale-in {
position: relative;
z-index: 100;
pointer-events: none;
}
}
// Directional classes
//
// Move the menu and the caret attached to it. Requires at least one of these on
// the `.dropdown-menu` element.
.dropdown-menu-w {
top: 0;
right: 100%;
left: auto;
width: auto;
margin-top: 0;
margin-right: 10px;
&::before {
top: 10px;
right: -16px;
left: auto;
border-color: transparent;
border-left-color: $black-fade-15;
}
&::after {
top: 11px;
right: -14px;
left: auto;
border-color: transparent;
border-left-color: $white;
}
}
.dropdown-menu-e {
top: 0;
left: 100%;
width: auto;
margin-top: 0;
margin-left: 10px;
&::before {
top: 10px;
left: -16px;
border-color: transparent;
border-right-color: $black-fade-15;
}
&::after {
top: 11px;
left: -14px;
border-color: transparent;
border-right-color: $white;
}
}
.dropdown-menu-ne {
top: auto;
bottom: 100%;
left: 0;
margin-bottom: 3px;
&::before,
&::after {
top: auto;
right: auto;
}
&::before {
bottom: -8px;
left: 9px;
border-top: 8px solid $black-fade-15;
border-right: 8px solid transparent;
border-bottom: 0;
border-left: 8px solid transparent;
}
&::after {
bottom: -7px;
left: 10px;
border-top: 7px solid $white;
border-right: 7px solid transparent;
border-bottom: 0;
border-left: 7px solid transparent;
}
}
.dropdown-menu-s {
right: 50%;
left: auto;
transform: translateX(50%);
&::before {
top: -16px;
right: 50%;
transform: translateX(50%);
}
&::after {
top: -14px;
right: 50%;
transform: translateX(50%);
}
}
.dropdown-menu-sw {
right: 0;
left: auto;
&::before {
top: -16px;
right: 9px;
left: auto;
}
&::after {
top: -14px;
right: 10px;
left: auto;
}
}
.dropdown-menu-se {
&::before {
top: -16px;
left: 9px;
}
&::after {
top: -14px;
left: 10px;
}
}