diff --git a/scss/base/variables.scss b/scss/base/variables.scss
index 0032b22e..28782cde 100644
--- a/scss/base/variables.scss
+++ b/scss/base/variables.scss
@@ -7,6 +7,7 @@ $background-color: $color-white;
$cursor-url: url(https://unpkg.com/nes.css/assets/cursor.png);
$cursor-click-url: url(https://unpkg.com/nes.css/assets/cursor-click.png);
+$border-size: 0.25em;
$default-colors: (
normal: $background-color,
diff --git a/scss/elements/balloons.scss b/scss/elements/balloons.scss
index 76690ea3..f6bcb0cc 100644
--- a/scss/elements/balloons.scss
+++ b/scss/elements/balloons.scss
@@ -1,25 +1,12 @@
.nes-balloon {
+ @include rounded-corners();
position: relative;
display: inline-block;
padding: 1rem 1.5rem;
margin: 8px;
margin-bottom: 30px;
- background-color: $background-color;
- // prettier-ignore
- box-shadow:
- 0 -4px $background-color,
- 0 -8px $base-color,
- 4px 0 $background-color,
- 4px -4px $base-color,
- 8px 0 $base-color,
- 0 4px $background-color,
- 0 8px $base-color,
- -4px 0 $background-color,
- -4px 4px $base-color,
- -8px 0 $base-color,
- -4px -4px $base-color,
- 4px 4px $base-color;
+ background-color: $background-color;
> :last-child {
margin-bottom: 0;
diff --git a/scss/elements/buttons.scss b/scss/elements/buttons.scss
index 28a2fca4..1f428198 100644
--- a/scss/elements/buttons.scss
+++ b/scss/elements/buttons.scss
@@ -1,81 +1,34 @@
@mixin btn-style($color, $background, $hover-background, $shadow) {
color: $color;
background-color: $background;
- box-shadow: inset -4px -4px $shadow;
- &:hover,
- &:focus {
- background-color: $hover-background;
- box-shadow: inset -6px -6px $shadow;
- }
-
- &:active {
- box-shadow: inset 4px 4px $shadow;
+ &::after {
+ position: absolute;
+ top: -$border-size;
+ right: -$border-size;
+ bottom: -$border-size;
+ left: -$border-size;
+ content: "";
+ box-shadow: inset -4px -4px $shadow;
}
-}
-
-@mixin btn-extra-pixelize-style($color, $background, $hover-background, $shadow) {
- color: $color;
- background-color: $background;
&:hover,
&:focus {
background-color: $hover-background;
- outline: 0;
- // prettier-ignore
- box-shadow:
- 0 -4px $hover-background,
- inset 0 -2px $shadow,
- 0 -8px $base-color,
- 4px 0 $shadow,
- 4px -4px $base-color,
- 8px 0 $base-color,
- 0 4px $shadow,
- 4px 4px $base-color,
- 0 8px $base-color,
- -4px 0 $hover-background,
- inset -2px 0 $shadow,
- -4px -4px $base-color,
- -8px 0 $base-color,
- -4px 4px $base-color;
- }
- &:active {
- // prettier-ignore
- box-shadow:
- 0 -4px $shadow,
- 0 -8px $base-color,
- 4px 0 $hover-background,
- 4px -4px $base-color,
- 8px 0 $base-color,
- 0 4px $hover-background,
- 4px 4px $base-color,
- 0 8px $base-color,
- -4px 0 $shadow,
- -4px -4px $base-color,
- -8px 0 $base-color,
- -4px 4px $base-color;
+ &::after {
+ box-shadow: inset -6px -6px $shadow;
+ }
}
- // prettier-ignore
- box-shadow:
- 0 -4px $background,
- 0 -8px $base-color,
- 4px 0 $shadow,
- 4px -4px $base-color,
- 8px 0 $base-color,
- 0 4px $shadow,
- 4px 4px $base-color,
- 0 8px $base-color,
- -4px 0 $background,
- -4px -4px $base-color,
- -8px 0 $base-color,
- -4px 4px $base-color;
+ &:active::after {
+ box-shadow: inset 4px 4px $shadow;
+ }
}
// Default style
.nes-btn {
- $border-size: 4px;
+ @include compact-rounded-corners();
position: relative;
display: inline-block;
@@ -85,7 +38,6 @@
vertical-align: middle;
cursor: $cursor-click-url, pointer;
user-select: none;
- border: none;
@include btn-style(
$base-color,
@@ -94,32 +46,6 @@
map-get($default-colors, "shadow")
);
- &::before,
- &::after {
- position: absolute;
- box-sizing: content-box;
- width: 100%;
- height: 100%;
- content: "";
- border-color: $base-color;
- border-style: solid;
- border-width: $border-size;
- }
-
- &::before {
- top: $border-size * -1;
- left: 0;
- border-right: $border-size / 2;
- border-left: $border-size / 2;
- }
-
- &::after {
- top: 0;
- left: $border-size * -1;
- border-top: $border-size / 2;
- border-bottom: $border-size / 2;
- }
-
&:focus {
outline: 0;
}
@@ -147,30 +73,4 @@
@include btn-style(nth($type, 2), nth($type, 3), nth($type, 4), nth($type, 5));
}
}
-
- &.is-rounded {
- box-sizing: content-box;
- padding: 6px 8px;
- @include btn-extra-pixelize-style(
- $base-color,
- map-get($default-colors, "normal"),
- map-get($default-colors, "hover"),
- map-get($default-colors, "shadow")
- );
-
- &::before,
- &::after {
- border-width: 0;
- }
- @each $type in $types {
- &.is-#{nth($type, 1)} {
- @include btn-extra-pixelize-style(
- nth($type, 2),
- nth($type, 3),
- nth($type, 4),
- nth($type, 5)
- );
- }
- }
- }
}
diff --git a/scss/elements/containers.scss b/scss/elements/containers.scss
index 04a5fe94..110b39b1 100644
--- a/scss/elements/containers.scss
+++ b/scss/elements/containers.scss
@@ -1,36 +1,14 @@
.nes-container {
position: relative;
padding: 1.5rem 2rem;
+ border-color: black;
+ border-style: solid;
+ border-width: 4px;
> :last-child {
margin-bottom: 0;
}
- &::before,
- &::after {
- position: absolute;
- z-index: -1;
- content: "";
- }
-
- &::before {
- top: 0;
- right: 0;
- bottom: 0;
- left: 0;
- }
-
- &::after {
- top: 2px;
- right: 2px;
- bottom: 2px;
- left: 2px;
- border-color: $base-color;
- border-style: solid;
- border-width: 4px;
- border-radius: 4px;
- }
-
&.is-centered {
text-align: center;
}
@@ -65,13 +43,8 @@
&.is-dark {
color: $background-color;
- &::before {
- background-color: $base-color;
- }
-
- &::after {
- border-color: #fff;
- }
+ background-color: $base-color;
+ border-color: white;
&.with-title {
> .title {
@@ -81,45 +54,14 @@
}
}
- @mixin rounded($base, $background) {
- color: $base;
- border: none;
- border-radius: 0;
- // prettier-ignore
- box-shadow:
- 0 -4px $background,
- 0 -8px,
- 4px 0 $background,
- 4px -4px,
- 8px 0,
- 0 4px $background,
- 0 8px,
- -4px 0 $background,
- -4px 4px,
- -8px 0,
- -4px -4px,
- 4px 4px;
- }
-
&.is-rounded {
+ @include rounded-corners();
+
padding: 1rem 1.5rem;
margin: 14px 8px;
- &::after {
- @include rounded($base-color, $background-color);
- }
-
&.is-dark {
- &::after {
- @include rounded($background-color, $base-color);
- }
-
- &::before {
- top: -8px;
- right: -8px;
- bottom: -8px;
- left: -8px;
- }
+ @include rounded-corners(true);
}
&.with-title {
diff --git a/scss/elements/dialogs.scss b/scss/elements/dialogs.scss
index 4e2e8e32..8a4c236f 100644
--- a/scss/elements/dialogs.scss
+++ b/scss/elements/dialogs.scss
@@ -11,7 +11,6 @@
}
&.is-rounded {
- border: none;
- box-shadow: 4px 0 $base-color, -4px 0 $base-color, 0 4px $base-color, 0 -4px $base-color;
+ @include rounded-corners();
}
}
diff --git a/scss/elements/progress.scss b/scss/elements/progress.scss
index 007a87f7..53c6b132 100644
--- a/scss/elements/progress.scss
+++ b/scss/elements/progress.scss
@@ -1,11 +1,11 @@
.nes-progress {
+ @include compact-rounded-corners();
width: 100%;
height: 48px;
- padding: 4px;
margin: 4px;
color: $base-color;
background-color: $background-color;
- box-shadow: 4px 0, -4px 0, 0 4px, 0 -4px;
+
-webkit-appearance: none;
appearance: none;
diff --git a/scss/elements/tables.scss b/scss/elements/tables.scss
index 2e9a94ed..17b7dfd4 100644
--- a/scss/elements/tables.scss
+++ b/scss/elements/tables.scss
@@ -3,42 +3,69 @@
overflow-x: auto;
overflow-y: hidden;
}
+
.nes-table {
table-layout: fixed;
background-color: $background-color;
- @mixin thsAndTdsBoxShadow($color) {
- th,
- td {
- padding: 0.5rem;
- word-wrap: break-word;
+
+ tr {
+ margin-left: -0.25em;
+ }
+
+ th,
+ td {
+ position: relative;
+ padding: 0.5rem;
+ word-wrap: break-word;
+ border-color: $base-color;
+ border-style: solid;
+ border-width: 0 0.25em 0.25em 0;
+
+ &:last-child {
+ border-right-width: 0;
}
- tr {
- th + th {
- box-shadow: -4px 0 $color;
- }
- td {
- box-shadow: 0 -4px $color;
- }
- td:not(:first-child) {
- box-shadow: -4px 0 $color, 0 -4px $color;
- }
+ &::after,
+ &::before {
+ position: absolute;
+ display: block;
+ width: 0.25em;
+ height: 0.25em;
+ content: "";
+ background-color: $base-color;
+ }
+
+ &::after {
+ bottom: -0.25em;
+ left: -0.25em;
+ }
+
+ &::before {
+ top: -0.25em;
+ right: -0.25em;
+ }
+
+ &:last-child::before {
+ top: initial;
+ bottom: -0.25em;
}
}
+
&.is-centered th {
text-align: center;
}
+
&.is-bordered {
margin: 4px;
- box-shadow: 4px 0 $base-color, 0 -4px $base-color, -4px 0 $base-color, 0 4px $base-color;
- @include thsAndTdsBoxShadow($base-color);
+ border-spacing: 0;
+ border-collapse: separate;
+
+ @include compact-rounded-corners();
}
+
&.is-dark {
- position: relative;
color: $background-color;
background-color: $base-color;
- box-shadow: 4px -4px $base-color, -4px -4px $base-color, -4px 4px $base-color,
- 4px 4px $base-color;
&::before {
position: absolute;
@@ -47,14 +74,40 @@
bottom: 0;
left: 0;
content: "";
- background: linear-gradient(to left, transparent 4px, $background-color 4px) no-repeat,
- linear-gradient(to bottom, transparent 4px, $background-color 4px) no-repeat,
- linear-gradient(to right, transparent 4px, $background-color 4px) no-repeat,
- linear-gradient(to top, transparent 4px, $background-color 4px) no-repeat;
- background-position: 100% 0, 100% 0, 0 100%, 0 100%;
- background-size: calc(100% - 4px) 4px, 4px calc(100% - 4px);
}
- @include thsAndTdsBoxShadow($background-color);
+ &.is-bordered {
+ @include compact-rounded-corners(true);
+ }
+
+ th,
+ td {
+ border-color: $background-color;
+
+ &::after,
+ &::before {
+ display: none;
+ }
+ }
+ }
+
+ /*************************************************************************** \
+ This eliminates the gap between the last row in a table and the border, as
+ well as hiding the derelict pixels in the bottom right and bottom left of
+ the last row of a table
+ \ ***************************************************************************/
+ tbody,
+ thead:last-child {
+ tr:last-child {
+ th,
+ td {
+ border-bottom-width: 0;
+
+ &:first-child::after,
+ &:last-child::before {
+ display: none;
+ }
+ }
+ }
}
}
diff --git a/scss/form/inputs.scss b/scss/form/inputs.scss
index 55d3a6d9..5a33ebdd 100644
--- a/scss/form/inputs.scss
+++ b/scss/form/inputs.scss
@@ -1,19 +1,15 @@
.nes-input,
.nes-textarea {
@mixin border-style($border, $outline) {
+ @include compact-rounded-corners();
+ @include compact-border-image($border);
+
outline-color: $outline;
- // prettier-ignore
- box-shadow:
- 0 4px $border,
- 0 -4px $border,
- 4px 0 $border,
- -4px 0 $border;
}
width: 100%;
padding: 0.5rem 1rem;
margin: 4px;
- border: none;
@include border-style($base-color, map-get($default-colors, "hover"));
diff --git a/scss/form/selects.scss b/scss/form/selects.scss
index 69dd0dc9..32bb098d 100644
--- a/scss/form/selects.scss
+++ b/scss/form/selects.scss
@@ -15,15 +15,15 @@
margin: 4px;
select {
+ @include compact-rounded-corners();
width: 100%;
padding: 0.5rem 2.5rem 0.5rem 1rem;
- -webkit-appearance: none;
- appearance: none;
cursor: $cursor-click-url, pointer;
- border: none;
border-radius: 0;
outline-color: map-get($default-colors, "hover");
- box-shadow: 0 4px $color-black, 0 -4px $color-black, 4px 0 $color-black, -4px 0 $color-black;
+
+ -webkit-appearance: none;
+ appearance: none;
&:invalid {
color: map-get($disabled-colors, shadow);
@@ -56,8 +56,9 @@
}
select {
+ @include compact-border-image($color);
+
outline-color: nth($type, 3);
- box-shadow: 0 4px $color, 0 -4px $color, 4px 0 $color, -4px 0 $color;
}
}
}
diff --git a/scss/utilities/_index.scss b/scss/utilities/_index.scss
index eee79a50..84834150 100644
--- a/scss/utilities/_index.scss
+++ b/scss/utilities/_index.scss
@@ -2,3 +2,4 @@
@import "animations.scss";
@import "icon-mixin.scss";
+@import "rounded-corners-mixin.scss";
diff --git a/scss/utilities/rounded-corners-mixin.scss b/scss/utilities/rounded-corners-mixin.scss
new file mode 100644
index 00000000..a96d94f5
--- /dev/null
+++ b/scss/utilities/rounded-corners-mixin.scss
@@ -0,0 +1,46 @@
+%rounded-corner-defaults {
+ border-style: solid;
+ border-width: $border-size;
+}
+
+@mixin border-image($color) {
+ border-image-source: url('data:image/svg+xml;utf8,');
+}
+
+@mixin compact-border-image($color) {
+ border-image-source: url('data:image/svg+xml;utf8,');
+}
+
+@mixin rounded-corners($isDark: false) {
+ @extend %rounded-corner-defaults;
+
+ border-image-slice: 3;
+ border-image-width: 3;
+
+ @if $isDark {
+ @include border-image($color-white);
+
+ border-image-outset: 0;
+ } @else {
+ @include border-image($color-black);
+
+ border-image-outset: 2;
+ }
+}
+
+@mixin compact-rounded-corners($isDark: false) {
+ @extend %rounded-corner-defaults;
+
+ border-image-slice: 2;
+ border-image-width: 2;
+
+ @if $isDark {
+ @include compact-border-image($color-white);
+
+ border-image-outset: 0;
+ } @else {
+ @include compact-border-image($color-black);
+
+ border-image-outset: 2;
+ }
+}