Skip to content

Commit

Permalink
feat: focus styles for Textbox and Textarea components
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbert committed Aug 5, 2021
1 parent 104c4a4 commit a51a17e
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 26 deletions.
25 changes: 25 additions & 0 deletions components/textarea/bem.css → components/textarea/bem.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright (c) 2021 Robbert Broersma
*/

@import "../focus/bem";

.utrecht-textarea {
border-width: var(--utrecht-textarea-border-width);
border-bottom-width: var(--utrecht-textarea-border-bottom-width, var(--utrecht-textarea-border-width));
Expand Down Expand Up @@ -30,7 +32,30 @@
color: var(--utrecht-textarea-disabled-color);
}

.utrecht-textarea--focus {
@include utrecht-focus;
}

.utrecht-textarea--read-only {
border-color: var(--utrecht-textarea-read-only-border-color);
color: var(--utrecht-textarea-read-only-color);
}

.utrecht-textarea--html-textarea {
&:disabled {
@extend .utrecht-textarea--disabled;
}

&:focus {
@extend .utrecht-textarea--focus;
}

&:invalid,
&[aria-invalid="true"] {
@extend .utrecht-textarea--invalid;
}

&:read-only {
@extend .utrecht-textarea--read-only;
}
}
14 changes: 1 addition & 13 deletions components/textarea/html.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,5 @@

.utrecht-html textarea {
@extend .utrecht-textarea;
}

.utrecht-html textarea:disabled {
@extend .utrecht-textarea--disabled;
}

.utrecht-html textarea:invalid,
.utrecht-html textarea[aria-invalid="true"] {
@extend .utrecht-textarea--invalid;
}

.utrecht-html textarea:read-only {
@extend .utrecht-textarea--read-only;
@extend .utrecht-textarea--html-textarea;
}
25 changes: 25 additions & 0 deletions components/textbox/bem.css → components/textbox/bem.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright (c) 2021 Robbert Broersma
*/

@import "../focus/bem";

.utrecht-textbox {
border-width: var(--utrecht-textbox-border-width);
border-bottom-width: var(--utrecht-textbox-border-bottom-width, var(--utrecht-textbox-border-width));
Expand Down Expand Up @@ -31,7 +33,30 @@
color: var(--utrecht-textbox-disabled-color);
}

.utrecht-textbox--focus {
@include utrecht-focus;
}

.utrecht-textbox--read-only {
border-color: var(--utrecht-textbox-read-only-border-color);
color: var(--utrecht-textbox-read-only-color);
}

.utrecht-textbox--html-input {
&:disabled {
@extend .utrecht-textbox--disabled;
}

&:focus {
@extend .utrecht-textbox--focus;
}

&:invalid,
&[aria-invalid="true"] {
@extend .utrecht-textbox--invalid;
}

&:read-only {
@extend .utrecht-textbox--read-only;
}
}
14 changes: 1 addition & 13 deletions components/textbox/html.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,7 @@
input[type="url"] {
& {
@extend .utrecht-textbox;
}

&:disabled {
@extend .utrecht-textbox--disabled;
}

&:invalid,
&[aria-invalid="true"] {
@extend .utrecht-textbox--invalid;
}

&:read-only {
@extend .utrecht-textbox--read-only;
@extend .utrecht-textbox--html-input;
}
}
}

0 comments on commit a51a17e

Please sign in to comment.