-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Jon Rohan <rohan@github.com>
- Loading branch information
Showing
4 changed files
with
266 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@primer/view-components": patch | ||
--- | ||
|
||
Move `dropdown` styles to PVC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,260 @@ | ||
/* dropdown */ | ||
|
||
.dropdown { | ||
position: relative; | ||
} | ||
|
||
.dropdown-caret { | ||
display: inline-block; | ||
width: 0; | ||
height: 0; | ||
vertical-align: middle; | ||
content: ''; | ||
border-style: solid; | ||
border-width: var(--primer-borderWidth-thicker, 4px) var(--primer-borderWidth-thicker, 4px) 0; | ||
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: var(--primer-control-small-paddingBlock, 4px); | ||
padding-bottom: var(--primer-control-small-paddingBlock, 4px); | ||
margin-top: 2px; | ||
list-style: none; | ||
background-color: var(--color-canvas-overlay); | ||
background-clip: padding-box; | ||
border: var(--primer-borderWidth-thin, 1px) solid var(--color-border-default); | ||
border-radius: var(--primer-borderRadius-medium, 6px); | ||
box-shadow: var(--color-shadow-large); | ||
|
||
&::before, | ||
&::after { | ||
position: absolute; | ||
display: inline-block; | ||
content: ''; | ||
} | ||
|
||
/* caret border */ | ||
&::before { | ||
border: 8px solid transparent; | ||
border-bottom-color: var(--color-border-default); | ||
} | ||
|
||
/* caret background (should match dropdown background) */ | ||
&::after { | ||
border: 7px solid transparent; | ||
border-bottom-color: var(--color-canvas-overlay); | ||
} | ||
|
||
& > ul { | ||
list-style: none; | ||
} | ||
} | ||
|
||
.dropdown-menu-no-overflow { | ||
width: auto; | ||
|
||
& .dropdown-item { | ||
padding: var(--primer-control-small-paddingBlock, 4px) var(--primer-control-medium-paddingInline-spacious, 16px); | ||
overflow: visible; | ||
text-overflow: inherit; | ||
} | ||
} | ||
|
||
/* Dropdown items (can be links or buttons) */ | ||
.dropdown-item { | ||
display: block; | ||
padding: var(--primer-control-small-paddingBlock, 4px) var(--primer-control-medium-paddingInline-condensed, 8px) var(--primer-control-small-paddingBlock, 4px) var(--primer-control-medium-paddingInline-spacious, 16px); | ||
overflow: hidden; | ||
color: var(--color-fg-default); | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
|
||
&:hover { | ||
color: var(--color-fg-on-emphasis); | ||
text-decoration: none; | ||
background-color: var(--color-accent-emphasis); | ||
|
||
& > .octicon { | ||
color: inherit; | ||
opacity: 1; | ||
} | ||
|
||
& [class*='color-text-'] { | ||
color: inherit !important; | ||
} | ||
|
||
& > .Label { | ||
color: inherit !important; | ||
border-color: currentcolor; | ||
} | ||
} | ||
|
||
&.btn-link { | ||
width: 100%; | ||
text-align: left; | ||
} | ||
} | ||
|
||
.dropdown-signout { | ||
width: 100%; | ||
text-align: left; | ||
background: none; | ||
border: 0; | ||
} | ||
|
||
.dropdown-divider { | ||
display: block; | ||
height: 0; | ||
margin: var(--primer-stack-gap-condensed, 8px) 0; | ||
border-top: var(--primer-borderWidth-thin, 1px) solid var(--color-border-default); | ||
} | ||
|
||
.dropdown-header { | ||
padding: var(--primer-control-small-paddingBlock, 4px) var(--primer-control-medium-paddingInline-spacious, 16px); | ||
font-size: var(--primer-text-body-size-small, 12px); | ||
color: var(--color-fg-muted); | ||
} | ||
|
||
.dropdown-item[aria-checked='false'] .octicon-check { | ||
display: 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: 8px; | ||
|
||
&::before { | ||
top: 10px; | ||
right: -16px; | ||
left: auto; | ||
border-color: transparent; | ||
border-left-color: var(--color-border-default); | ||
} | ||
|
||
&::after { | ||
top: 11px; | ||
right: -14px; | ||
left: auto; | ||
border-color: transparent; | ||
border-left-color: var(--color-canvas-overlay); | ||
} | ||
} | ||
|
||
.dropdown-menu-e { | ||
top: 0; | ||
left: 100%; | ||
width: auto; | ||
margin-top: 0; | ||
margin-left: 8px; | ||
|
||
&::before { | ||
top: 10px; | ||
left: -16px; | ||
border-color: transparent; | ||
border-right-color: var(--color-border-default); | ||
} | ||
|
||
&::after { | ||
top: 11px; | ||
left: -14px; | ||
border-color: transparent; | ||
border-right-color: var(--color-canvas-overlay); | ||
} | ||
} | ||
|
||
.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 var(--color-border-default); | ||
border-right: 8px solid transparent; | ||
border-bottom: 0; | ||
border-left: 8px solid transparent; | ||
} | ||
|
||
&::after { | ||
bottom: -7px; | ||
left: 10px; | ||
border-top: 7px solid var(--color-canvas-overlay); | ||
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters