feat(controls): styled custom header dropdown with helptext and smart positioning (#13)

This commit is contained in:
Benedikt Rötsch
2017-10-10 11:33:03 +02:00
parent 6c6d81873a
commit bb1cdcc3f6
14 changed files with 342 additions and 155 deletions

View File

@@ -27,22 +27,11 @@
justify-content: space-between;
align-items: center;
margin-bottom: calc(var(--grid-gutter) / 2);
@media (--breakpoint-desktop) {
flex: 0 1 auto;
flex-direction: row;
margin-bottom: 0;
}
& div + div {
margin: calc(var(--grid-gutter) / 2) 0 0;
@media (--breakpoint-desktop) {
margin: 0 0 0 calc(var(--grid-gutter) / 2);
}
}
}
@element upper-second {
@@ -56,14 +45,6 @@
flex: 0 1 auto;
flex-direction: row;
}
& div + div {
margin: calc(var(--grid-gutter) / 2) 0 0;
@media (--breakpoint-desktop) {
margin: 0 0 0 calc(var(--grid-gutter) / 2);
}
}
}
@element upper-link {
@@ -73,6 +54,11 @@
@element upper-copy {
display: inline-flex;
margin: 0 0 calc(var(--grid-gutter) / 2);
@media (--breakpoint-desktop) {
margin: 0 calc(var(--grid-gutter) / 2) 0 0;
}
}
@element upper-icon {
@@ -107,6 +93,10 @@
height: auto;
margin-right: calc(var(--grid-gutter) / 2);
}
@media (--breakpoint-desktop) {
margin: 0 calc(var(--grid-gutter) / 2) 0 0;
}
}
@element logo {
@@ -134,52 +124,98 @@
@media (--breakpoint-desktop) {
flex: 0 0 auto;
flex-direction: row;
}
}
@element controls_group {
flex: 0 0 auto;
position: relative;
display: flex;
margin: 0 0 calc(var(--grid-gutter) / 2);
padding: 0 calc(var(--grid-gutter) / 2);
border: none;
background: var(--color-palette-blue-medium);
border-radius: var(--border-radius);
color: inherit;
&:last-child {
margin: 0;
}
& form {
display: flex;
flex-wrap: wrap;
justify-content: center;
@media (--breakpoint-desktop) {
margin: 0 calc(var(--grid-gutter) / 2) 0 0;
}
}
@media (--breakpoint-desktop) {
justify-content: flex-end;
}
@element controls_label {
position: relative;
z-index: 1;
font-family: var(--font-medium);
cursor: pointer;
}
& .group {
flex: 0 0 auto;
display: flex;
padding: 0 calc(var(--grid-gutter) / 2);
margin: 0;
@element controls_dropdown {
position: absolute;
z-index: 2;
box-sizing: border-box;
border: none;
background: var(--color-palette-blue-medium);
border-radius: var(--border-radius);
color: inherit;
width: 260px;
max-width: 90vw;
margin: calc(var(--grid-gutter) / 2 - 4px) 0 0;
& + .group {
margin-left: var(--grid-gutter)
}
opacity: 0;
background: #fff;
border-radius: 2px;
box-shadow: 0 1px 3px 1px rgba(0, 0, 0, 0.1);
& select,
& label {
flex: 0 0 auto;
display: inline-block;
margin-top: 0;
margin-bottom: 0;
transition: 0.3s opacity ease;
pointer-events: none;
color: inherit;
font-weight: normal;
font-family: var(--font-medium);
font-size: 0.8em;
@modifier active {
opacity: 1;
pointer-events: all;
background: transparent;
border: none;
}
&:before {
content: '';
position: absolute;
left: 50%;
top: -5px;
width: 10px;
height: 10px;
& select {
margin-top: 2px;
}
background-color: inherit;
transform: translateX(-50%) rotate(45deg);
}
}
}
@element controls_help_text {
padding: calc(var(--grid-gutter) / 2);
color: var(--color-text-grey);
}
@element controls_button {
box-sizing: border-box;
height: auto;
width: 100%;
margin: 0;
border-radius: 0;
background: var(--header-dropdown-bg);
color: var(--header-dropdown-btn-color);
font-size: 1em;
&:hover {
background: var(--header-dropdown-bg-hover);
color: var(--header-dropdown-btn-color);
}
@modifier active {
background: var(--header-dropdown-bg-active);
}
}
}