webapp/src/components/_shared/GrowingTextarea/GrowingTextarea.module.scss

112 lines
1.9 KiB
SCSS
Raw Normal View History

2023-05-11 11:33:01 +00:00
.GrowingTextarea {
display: block;
width: 100%;
position: relative;
transition: 0.3s ease-in-out;
2023-05-11 11:33:01 +00:00
&.bordered {
box-sizing: border-box;
padding: 16px 12px;
border-radius: 2px;
border: 2px solid var(--black-100);
background: var(--white-500, #fff);
}
&.hasFieldName {
padding-top: 24px;
}
.fieldName {
@include font-size(1.2rem);
position: absolute;
top: 6px;
left: 12px;
color: var(--black-400);
}
2023-05-11 11:33:01 +00:00
.growWrap {
display: grid;
width: 100%;
&::after {
content: attr(data-replicated-value);
visibility: hidden;
transition: height 0.3s linear;
}
.textInput {
background: var(--background-color);
2023-05-11 11:33:01 +00:00
border: none;
color: var(--default-color);
margin-bottom: 0;
2023-05-11 11:33:01 +00:00
resize: none;
overflow: hidden;
2023-05-11 11:33:01 +00:00
&::placeholder {
color: #858585;
}
&:focus,
&:focus-visible,
&:active {
border: none;
outline: none;
box-shadow: none;
}
}
&::after,
& .textInput {
/* Identical styling required!! */
white-space: pre-wrap;
word-wrap: break-word;
overflow: hidden;
line-height: 1.2;
2023-05-11 11:33:01 +00:00
grid-area: 1 / 1 / 2 / 2;
width: 100%;
padding: 0;
margin: 0;
2023-05-11 11:33:01 +00:00
}
}
.maxLength {
color: var(--default-color);
opacity: 1;
position: absolute;
z-index: 1;
right: 0.6rem;
bottom: -1.2rem;
font-size: 1.1rem;
border: 3px solid rgba(#ccc, 0.5);
padding: 0.5rem;
border-radius: 1.3rem;
line-height: 1;
user-select: none;
transition: opacity 0.3s ease-in-out;
background: var(--white-500);
&.visible {
opacity: 1;
}
&.limited {
animation: blink 0.8s;
animation-iteration-count: 2;
}
}
&.bordered .maxLength {
opacity: 1;
font-weight: 500;
border: unset;
bottom: 0;
}
}
@keyframes blink {
50% {
border-color: #000;
}
2023-05-11 11:33:01 +00:00
}