Skip to content

Commit

Permalink
remove form-field-reset mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
basher committed Nov 11, 2024
1 parent 25dd82f commit 2193a70
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 48 deletions.
26 changes: 26 additions & 0 deletions ui/src/css/form/_form.scss
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,32 @@ Dependencies.
}
}

:is(.input, .select, .textarea) {
@include focus($background: true);
border: var(--border-width-s) solid;
padding: var(--gutter-s);

// Native HTML5 validation.
&:valid:required {
background-color: hsl(var(--color-accent-positive) / 10%);
border-color: $color-success;
border-width: var(--border-width-m);
}

&:user-invalid:required {
background-color: hsl(var(--color-accent-negative) / 10%);
border-color: $color-error;
border-width: var(--border-width-m);
}

// ARIA.
&[aria-invalid='true'] {
background-color: hsl(var(--color-accent-negative) / 10%);
border-color: $color-error;
border-width: var(--border-width-m);
}
}

.message--error {
+ .form {
margin-block-start: var(--gutter-m);
Expand Down
7 changes: 2 additions & 5 deletions ui/src/css/form/_input.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
/*
----------------------------------------------------------------------------
Dependencies.
Basic component styles are in "form.css".
----------------------------------------------------------------------------
*/
@use '../mixins' as *;
// @use '../base' as *;

.input {
@include form-field-reset;
//
}
6 changes: 2 additions & 4 deletions ui/src/css/form/_select.scss
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
/*
----------------------------------------------------------------------------
Dependencies.
Basic component styles are in "form.css".
----------------------------------------------------------------------------
*/
@use '../mixins' as *;
// @use '../mixins' as *;
@use '../base' as *;

.select {
@include form-field-reset;

@media (prefers-color-scheme: dark) {
option {
color: $color-neutral-900;
Expand Down
7 changes: 2 additions & 5 deletions ui/src/css/form/_textarea.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
/*
----------------------------------------------------------------------------
Dependencies.
Basic component styles are in "form.css".
----------------------------------------------------------------------------
*/
@use '../mixins' as *;
// @use '../base' as *;

.textarea {
@include form-field-reset;
//
}
33 changes: 0 additions & 33 deletions ui/src/css/mixins/_form-field-reset.scss

This file was deleted.

1 change: 0 additions & 1 deletion ui/src/css/mixins/_index.scss
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
@forward 'focus';
@forward 'form-field-reset';

0 comments on commit 2193a70

Please sign in to comment.