Skip to content

Instantly share code, notes, and snippets.

@docentedev
Created December 15, 2022 19:29
Show Gist options
  • Save docentedev/b08d509476684e63ab1cf5d59b992659 to your computer and use it in GitHub Desktop.
Save docentedev/b08d509476684e63ab1cf5d59b992659 to your computer and use it in GitHub Desktop.
dd.style.ts
import styled from 'styled-components';
export const Container = styled.div`
position: relative;
input {
padding: 8px 50px 8px 16px;
width: 100%;
border: none;
border-radius: 8px;
height: 46px;
font-size: 16px;
font-family: Open Sans, Arial, Helvetiva, Sans;
outline: none;
}
label {
position: absolute;
left: 1rem;
top: 8px;
background: rgb(255, 255, 255);
padding: 4px;
border-radius: 4px;
transition: top 100ms ease-in 0s, left 100ms ease-in 0s, font-size 100ms ease-in 0s;
text-align: left;
z-index: 1;
pointer-events: none;
}
&[data-open='true'] label,
&[data-focus='true'] label,
&[data-label-selected='true'] label {
top: -12px;
transition: top 100ms ease-in 0s, left 100ms ease-in 0s, font-size 100ms ease-in 0s;
font-family: 'Open Sans';
width: fit-content;
font-weight: 700;
color: rgb(50, 58, 68);
font-size: 12px;
line-height: 16px;
font-style: normal;
letter-spacing: 0.25px;
}
&[data-focus='true'] > div:first-child {
outline: solid 1px rgb(50, 58, 68);
}
> div:first-child > div:last-child {
position: absolute;
top: 12.5px;
left: 16px;
font-size: 16px;
}
> div:first-child {
font-size: 16px;
color: rgb(50, 58, 68);
background: rgb(255, 255, 255);
height: 48px;
border-radius: 8px;
font-weight: 400;
padding: 0;
border: 1px solid rgb(22, 109, 194);
width: 100%;
position: relative;
}
& > div:first-child > div:first-child > span:last-child {
position: absolute;
right: 20px;
top: 11px;
fill: rgb(22, 109, 194);
}
&[data-open='false'] > div:first-child > div:last-child {
display: block;
pointer-events: none;
}
&[data-open='true'] > div:first-child > div:last-child {
display: none;
}
button[data-finded='false'][data-persistent='false'] {
display: none;
}
&[data-open='true'] > div:last-child {
display: flex;
}
&[data-open='false'] > div:last-child {
display: none;
}
> div:last-child {
position: absolute;
top: 3.5rem;
width: 100%;
z-index: 2;
overflow: auto;
max-height: 333px;
background: rgb(255, 255, 255);
border-radius: 8px;
box-shadow: rgb(50 58 68 / 6%) 0px 8px 24px;
font-size: 14px;
flex-direction: column;
}
&[data-direction='top'] > div:last-child {
top: auto;
bottom: 3.7rem;
}
&[data-hint='true'][data-direction='top'] > div:last-child {
top: auto;
bottom: 5.3rem;
}
> div:last-child button {
position: relative;
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-start;
padding: 8px 16px;
width: 100%;
height: 40px;
font-size: 14px;
line-height: 21px;
border: none;
background: white;
}
> div:last-child button:hover {
background: rgb(225, 240, 255);
color: rgb(22, 109, 194);
}
button[data-active='true']::before {
content: attr(data-label);
position: absolute;
color: #176dc2;
font-weight: 700;
}
button[data-active='true'],
> div:last-child [data-active='true']:hover {
color: transparent;
}
&[data-variant='error'] > div:first-child {
border-color: #e54717;
outline: solid 1px #e54717;
}
&[data-variant='success'] > div:first-child {
border-color: #b6dfd6;
outline: solid 1px #b6dfd6;
}
&[data-variant='warning'] > div:first-child {
border-color: #dbc717;
outline: solid 1px #dbc717;
}
& > div:first-child > div:first-child > i {
position: absolute;
right: 3rem;
top: 11px;
pointer-events: none;
fill: rgb(50, 58, 68);
}
&[data-variant='error'] > div:first-child > div:first-child > i {
fill: #e64618;
}
&[data-variant='success'] > div:first-child > div:first-child > i {
fill: #22a889;
}
&[data-variant='warning'] > div:first-child > div:first-child > i {
fill: #dbc717;
}
&:not([data-variant='default']) input {
padding: 8px 80px 8px 16px;
}
`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment