-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(vara-ui): add dark mode to
Textarea
, drop floating label (#1695)
Co-authored-by: Nikita Yutanov <nikitayutanov@gmail.com>
- Loading branch information
1 parent
efa7fe1
commit b3a1566
Showing
3 changed files
with
42 additions
and
175 deletions.
There are no files selected for viewing
156 changes: 18 additions & 138 deletions
156
utils/vara-ui/src/components/textarea/textarea.module.scss
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,149 +1,29 @@ | ||
.root { | ||
&.disabled { | ||
pointer-events: none; | ||
opacity: 0.3; | ||
} | ||
} | ||
|
||
.base { | ||
position: relative; | ||
} | ||
|
||
.textarea, | ||
.label { | ||
font-weight: 400; | ||
line-height: 24px; | ||
letter-spacing: 0.009em; | ||
color: #010500; | ||
|
||
&.default { | ||
font-size: 16px; | ||
} | ||
|
||
&.small { | ||
font-size: 14px; | ||
} | ||
} | ||
@use '../../utils.scss' as *; | ||
|
||
.textarea { | ||
outline: none; | ||
resize: none; | ||
background-color: transparent; | ||
border: none; | ||
font: inherit; | ||
@include lightDark(color, #000, rgba(246, 246, 246, 0.9)); | ||
|
||
padding: 0; | ||
background: transparent; | ||
border: none; | ||
outline: none; | ||
width: 100%; | ||
padding-right: 14px; | ||
padding-left: 14px; | ||
|
||
&:not(:focus) { | ||
&::placeholder { | ||
color: transparent; | ||
} | ||
} | ||
|
||
&:focus, | ||
&:not(:placeholder-shown), | ||
&.error { | ||
~ .label { | ||
opacity: 0; | ||
} | ||
|
||
~ .fieldset { | ||
.legendLabel { | ||
opacity: 1; | ||
max-width: 100%; | ||
padding: 0 4px; | ||
} | ||
} | ||
} | ||
|
||
&:focus { | ||
~ .fieldset { | ||
border-color: #00b387; | ||
|
||
.legendLabel { | ||
color: #00b387; | ||
} | ||
} | ||
} | ||
|
||
&.error { | ||
~ .fieldset { | ||
border-color: #fc174d; | ||
|
||
.legendLabel { | ||
color: #fc174d; | ||
} | ||
} | ||
} | ||
font-family: inherit; | ||
font-size: var(--input-font-size); | ||
font-weight: 400; | ||
line-height: var(--input-line-height); | ||
resize: none; | ||
|
||
&.default { | ||
padding-top: 13px; | ||
padding-bottom: 13px; | ||
&:not(:disabled)[aria-invalid='true'] { | ||
@include lightDark(color, #ff3231, #ff3757); | ||
} | ||
|
||
&.small { | ||
padding-top: 8px; | ||
padding-bottom: 8px; | ||
&:disabled, | ||
&:disabled::placeholder { | ||
@include lightDark(color, rgba(88, 105, 110, 0.5), rgba(156, 172, 177, 0.4)); | ||
} | ||
} | ||
|
||
.label { | ||
pointer-events: none; | ||
|
||
position: absolute; | ||
left: 13px; | ||
|
||
&.default { | ||
top: 13px; | ||
&::placeholder { | ||
@include lightDark(color, #58696e, #828b8e); | ||
} | ||
|
||
&.small { | ||
top: 8px; | ||
} | ||
} | ||
|
||
.fieldset { | ||
min-width: 0; | ||
margin: 0; | ||
padding: 0 13px; | ||
pointer-events: none; | ||
|
||
position: absolute; | ||
/* TODO: variables */ | ||
top: -6px; | ||
bottom: 0; | ||
left: 0; | ||
right: 0; | ||
|
||
border: 1px solid #0000003b; | ||
border-radius: 4px; | ||
} | ||
|
||
.legend, | ||
.message { | ||
font-size: 12px; | ||
font-weight: 400; | ||
line-height: 1; | ||
letter-spacing: 0.01em; | ||
} | ||
|
||
.legend { | ||
opacity: 0; | ||
max-width: 0.01px; | ||
height: 1em; | ||
padding: 0; | ||
|
||
color: #313635; | ||
} | ||
|
||
.message { | ||
margin: 4px 0 0 0; | ||
|
||
color: #fc174d; | ||
} | ||
|
||
.block { | ||
width: 100%; | ||
} |
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