Skip to content

Commit

Permalink
🚑 Consistent :focus with new modern look (#81)
Browse files Browse the repository at this point in the history
* better focus

* tweaked focus transparentizing
  • Loading branch information
MarkusJohansen authored Jan 11, 2024
1 parent efcc011 commit cc4f825
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 53 deletions.
78 changes: 45 additions & 33 deletions build/chimera.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/chimera.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 4 additions & 10 deletions src/elements/_buttons.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
@import "focus";

button,
input[type="button"],
input[type="submit"] {
@extend %focus-base-component;
background-color: $Chimera;
color: $Chimera-text-secondary;
font-size: medium;
Expand All @@ -14,28 +17,19 @@ input[type="button"]:hover,
input[type="submit"]:hover {
background-color: $Chimera-dark;
border-color: $Chimera-dark;
color: $Chimera-text;
cursor: pointer;
transition: 200ms ease-in-out;
}

button:active,
input[type="button"]:active,
input[type="submit"]:active {
border-color: $Chimera-darker;
background-color: $Chimera-darker;
transition: 200ms ease-in-out;
}

button:disabled,
input[type="button"]:disabled,
input[type="submit"]:disabled {
border-color: $Chimera-darker;
background-color: $Chimera-darker;
}

button:focus,
input[type="button"]:focus,
input[type="submit"]:focus {
outline: $Chimera-focus 1px solid;
}
}
8 changes: 8 additions & 0 deletions src/elements/_focus.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
%focus-base-component {
outline: none;
transition: 150ms, box-shadow 150ms ease-in-out;
}

%focus-base-component:focus {
box-shadow: 0 0 0 3px transparentize($Chimera-focus, 0.25);
}
2 changes: 1 addition & 1 deletion src/elements/_main.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@import "textfields";
@import "buttons";
@import "blockquotes";
@import "formatted-text";
Expand All @@ -11,5 +12,4 @@
@import "radio-checkbox-groups";
@import "tables";
@import "text";
@import "textfields";
@import "base";
12 changes: 4 additions & 8 deletions src/elements/_textfields.scss
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
@import "focus";

textarea,
input {
@extend %focus-base-component;
font-family: $font-stack;
color: $Chimera-text;
background-color: $Chimera-bg;
font-size: medium;
border-radius: 0.5em;
border: solid 2px $Chimera-border;
outline: none;
width: 100%;
box-sizing: border-box;
margin: 0.5em 0;
padding: 0.75em 0 0.75em 0.75em;
resize: none;
Expand All @@ -17,9 +18,4 @@ input {
textarea:disabled,
input:disabled{
color: $Chimera-text-disabled;
}

textarea:focus,
input:focus {
border: solid 2px $Chimera-focus;
}
}

0 comments on commit cc4f825

Please sign in to comment.