Created
December 10, 2020 20:57
-
-
Save AleksandrSl/62f0ec843e5065c5863abfbde3ec1465 to your computer and use it in GitHub Desktop.
Material design like styles
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
.md-container { | |
position: relative; | |
width: 100%; | |
} | |
.container { | |
position: relative; | |
width: 100%; | |
height: 3em; | |
color: var(--grey-700); | |
} | |
.md-select__btn { | |
position: relative; | |
display: flex; | |
align-items: center; | |
width: 100%; | |
height: max-content; | |
min-height: 3em; | |
transition: all 0.2s linear; | |
} | |
.md-select__btn:focus, | |
.md-select__btn:active { | |
outline: none; | |
} | |
.md-border, | |
.md-select__btn::before { | |
position: absolute; | |
left: 0; | |
width: 100%; | |
pointer-events: none; | |
content: ""; | |
} | |
.md-outlined .md-border, | |
.md-outlined .md-select__btn::before { | |
top: 0; | |
height: 100%; | |
border: 1px solid var(--grey-500); | |
border-radius: 4px; | |
} | |
.md-filled .md-border, | |
.md-filled .md-select__btn::before { | |
bottom: 0; | |
height: 0; | |
border-bottom: 1px solid var(--grey-500); | |
} | |
.md-round-icon-btn { | |
padding: 0.7em; | |
color: var(--md-focus-color); | |
border-radius: 50%; | |
} | |
.md-round-icon-btn:focus, | |
.md-round-icon-btn:not(:disabled):hover { | |
cursor: pointer; | |
background-color: rgba(60, 64, 67, 0.08); | |
outline: none; | |
} | |
.md-filled .md-select__btn { | |
padding: 0 1em; | |
} | |
.md-label { | |
position: absolute; | |
top: 0.75em; | |
left: 1em; | |
font-weight: normal; | |
pointer-events: none; | |
cursor: pointer; | |
transition: all 0.1s linear; | |
} | |
.md-input { | |
position: relative; | |
display: block; | |
flex: 1; | |
width: 100%; | |
height: 100%; | |
color: var(--grey-900); | |
transition: all 0.3s linear; | |
} | |
.md-filled .md-input { | |
padding: 1em 1em 0.3em; | |
} | |
.md-filled .md-select__btn, | |
.md-filled .md-input { | |
background-color: var(--grey-100); | |
border-radius: 4px 4px 0 0; | |
} | |
.md-outlined .md-input, | |
.md-outlined .md-select__btn { | |
padding: var(--md-outlined-input-padding); | |
} | |
.md-input::placeholder { | |
opacity: 0; | |
} | |
.md-input:focus:not(.invalid) { | |
caret-color: var(--md-focus-color); | |
} | |
.md-input.invalid { | |
caret-color: var(--dark-red); | |
} | |
.md-input.invalid ~ .md-label, | |
.md-select__btn.invalid .md-label { | |
color: var(--dark-red) !important; | |
} | |
.md-input:focus ~ .md-label, | |
.md-select__btn:focus .md-label, | |
.md-container:focus-within .md-label { | |
color: var(--md-focus-color); | |
} | |
.md-input.invalid ~ .md-border, | |
.md-select__btn.invalid::before { | |
border-color: var(--dark-red) !important; | |
} | |
.md-input:disabled ~ .md-border, | |
.md-select__btn:disabled::before { | |
border-color: var(--grey-300); | |
} | |
.md-input:focus:not(.invalid) ~ .md-border, | |
.md-container:focus-within .md-select__btn::before { | |
border-color: var(--md-focus-color); | |
border-width: 2px; | |
} | |
.md-filled .md-input:focus, | |
.md-filled.md-container:focus-within .md-select__btn { | |
background-color: var(--grey-300); | |
} | |
.md-filled .md-input:hover:not(:disabled):not(:focus), | |
.md-filled.md-container:not(:focus-within) .md-select__btn:hover { | |
background-color: var(--grey-200); | |
} | |
.md-input:hover:not(:disabled):not(:focus):not(.invalid) ~ .md-border, | |
.md-container:not(:focus-within) .md-select__btn:hover:not(.invalid):not(:disabled)::before { | |
border-color: var(--grey-900); | |
} | |
.md-filled .md-label.filled, | |
.md-filled .md-input:focus ~ .md-label, | |
.md-filled .md-input:not(:placeholder-shown) ~ .md-label { | |
top: 0.2em; | |
left: 1.5em; | |
font-size: 0.7em; | |
} | |
.md-outlined .md-input:focus ~ .md-label, | |
.md-outlined .md-input:not(:placeholder-shown) ~ .md-label, | |
.md-outlined .md-label.filled { | |
top: -0.7em; | |
padding: 0 0.5em; | |
font-size: 0.7em; | |
background-color: white; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment