This repository has been archived by the owner on Dec 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dropdown): Add dropdown dropup button molecule
- Loading branch information
Showing
7 changed files
with
143 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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
'use strict'; | ||
|
||
require('./prism'); | ||
require('./interactions'); | ||
|
||
/** | ||
* Global `fabricator` object | ||
|
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,11 @@ | ||
// /* Demo Dropdowns and Dropups (button-dropdown.html) */ | ||
$(document).ready(function() { | ||
$("#dropdownExample").click(function(e){ | ||
e.preventDefault(); | ||
$("#dropdownExampleList").toggle(); | ||
}); | ||
$("#dropupExample").click(function(e){ | ||
e.preventDefault(); | ||
$("#dropupExampleList").toggle(); | ||
}); | ||
}); |
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,30 @@ | ||
--- | ||
name: button group | ||
title: button group | ||
notes: | | ||
Wrap buttons and a list with `dc-btn-dropdown` to make dropdown that come from buttons. | ||
--- | ||
<div class="dc-btn-dropdown"> | ||
<button class="dc-btn dc-btn--primary" id="dropdownExample"> | ||
Dropdown | ||
<span class="dc-arrow-down"></span> | ||
</button> | ||
<ul class="dc-dropdown-list" id="dropdownExampleList"> | ||
<li><a href="#">The first option</a></li> | ||
<li><a href="#">The second option</a></li> | ||
<li class="disabled"><a href="#">Disabled option</a></li> | ||
</ul> | ||
</div> | ||
|
||
<div class="dc-btn-dropup"> | ||
<button class="dc-btn dc-btn--primary" id="dropupExample"> | ||
Dropup | ||
<span class="dc-arrow-up"></span> | ||
</button> | ||
<ul class="dc-dropdown-list" id="dropupExampleList"> | ||
<li><a href="#">The first option</a></li> | ||
<li><a href="#">The second option</a></li> | ||
<li class="dc-divider"></li> | ||
<li><a href="#">Separated option</a></li> | ||
</ul> | ||
</div> |
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
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,93 @@ | ||
.dc-btn-dropdown, | ||
.dc-btn-dropup { | ||
// FIXME: Prefer using placeholder selectors (e.g. %some-placeholder) with @extend | ||
// scss-lint:disable PlaceholderInExtend | ||
@extend .dc-cf; | ||
// scss-lint:enable PlaceholderInExtend | ||
position: relative; | ||
} | ||
|
||
.dc-arrow-down, | ||
.dc-arrow-up { | ||
display: inline-block; | ||
width: 0; | ||
height: 0; | ||
margin-right: 0; | ||
margin-left: 4px; | ||
border-right: 5px solid transparent; | ||
border-left: 5px solid transparent; | ||
overflow: visible; | ||
vertical-align: middle; | ||
} | ||
|
||
.dc-arrow-down { | ||
border-top: 5px dashed; | ||
} | ||
|
||
.dc-arrow-up { | ||
border-bottom: 5px dashed; | ||
} | ||
|
||
|
||
.dc-dropdown-list { | ||
display: none; | ||
position: absolute; | ||
padding: $dc-space50 0; | ||
border-radius: $dc-radius100; | ||
background-color: $dc-white; | ||
box-shadow: 0 4px 8px rgba($dc-black, .2); | ||
z-index: 999; | ||
list-style-type: none; | ||
|
||
.dc-divider { | ||
height: 1px; | ||
margin: $dc-space50 0; | ||
background-color: $dc-gray60; | ||
overflow: hidden; | ||
} | ||
|
||
.disabled { | ||
cursor: not-allowed; | ||
opacity: .5; | ||
|
||
* { | ||
cursor: not-allowed; | ||
pointer-events: none; | ||
} | ||
} | ||
|
||
a { | ||
display: block; | ||
padding: 0 $dc-space100; | ||
line-height: $dc-space200; | ||
text-decoration: none; | ||
|
||
&:hover { | ||
background-color: $dc-gray70; | ||
} | ||
|
||
&:visited { | ||
color: $dc-gray10; | ||
} | ||
|
||
&:active { | ||
background-color: $dc-orange50; | ||
color: $dc-orange20; | ||
} | ||
|
||
&:focus { | ||
outline: none; | ||
} | ||
} | ||
|
||
.dc-btn-dropdown & { | ||
top: 100%; | ||
margin-top: -$dc-space75; | ||
} | ||
|
||
.dc-btn-dropup & { | ||
bottom: 100%; | ||
margin-bottom: $dc-space75; | ||
} | ||
|
||
} |
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 |
---|---|---|
|
@@ -18,3 +18,5 @@ | |
@import "modules/toast"; | ||
@import "modules/loading-bar"; | ||
@import "modules/divider"; | ||
@import "modules/dropdown"; | ||
|