From 79da41480dc18f86cc968740e54e3e13c2f7c6a3 Mon Sep 17 00:00:00 2001 From: ysds Date: Mon, 22 Jan 2018 10:19:13 +0900 Subject: [PATCH 1/5] Refactoring the button-group negative margin --- scss/_button-group.scss | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/scss/_button-group.scss b/scss/_button-group.scss index c1b826536c50..fdabb9846db5 100644 --- a/scss/_button-group.scss +++ b/scss/_button-group.scss @@ -22,14 +22,6 @@ z-index: 1; } } - - // Prevent double borders when buttons are next to each other - .btn + .btn, - .btn + .btn-group, - .btn-group + .btn, - .btn-group + .btn-group { - margin-left: -$btn-border-width; - } } // Optional: Group multiple button groups together for a toolbar @@ -44,8 +36,12 @@ } .btn-group { - > .btn:first-child { - margin-left: 0; + // Prevent double borders when buttons are next to each other + .btn + .btn, + .btn + .btn-group, + .btn-group + .btn, + .btn-group + .btn-group { + margin-left: -$btn-border-width; } // Reset rounded corners @@ -123,7 +119,6 @@ > .btn-group + .btn, > .btn-group + .btn-group { margin-top: -$btn-border-width; - margin-left: 0; } // Reset rounded corners From c40f3b4f3a7db9b8125dec7fe072128c44a9389a Mon Sep 17 00:00:00 2001 From: ysds Date: Mon, 22 Jan 2018 10:51:17 +0900 Subject: [PATCH 2/5] Use :not() selector --- scss/_button-group.scss | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/scss/_button-group.scss b/scss/_button-group.scss index fdabb9846db5..f7e2fb1c79a8 100644 --- a/scss/_button-group.scss +++ b/scss/_button-group.scss @@ -37,10 +37,8 @@ .btn-group { // Prevent double borders when buttons are next to each other - .btn + .btn, - .btn + .btn-group, - .btn-group + .btn, - .btn-group + .btn-group { + .btn:not(:first-child), + .btn-group:not(:first-child), { margin-left: -$btn-border-width; } @@ -114,10 +112,8 @@ width: 100%; } - > .btn + .btn, - > .btn + .btn-group, - > .btn-group + .btn, - > .btn-group + .btn-group { + > .btn:not(:first-child), + > .btn-group:not(:first-child), { margin-top: -$btn-border-width; } From d0207e570c442fd4880157def4bc8cc8d6a9c451 Mon Sep 17 00:00:00 2001 From: ysds Date: Mon, 22 Jan 2018 10:57:52 +0900 Subject: [PATCH 3/5] Add direct children selectors to avoid cascading styles into a menu form (Similar issue #25279) --- scss/_button-group.scss | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scss/_button-group.scss b/scss/_button-group.scss index f7e2fb1c79a8..d93b8ad0cde4 100644 --- a/scss/_button-group.scss +++ b/scss/_button-group.scss @@ -37,8 +37,8 @@ .btn-group { // Prevent double borders when buttons are next to each other - .btn:not(:first-child), - .btn-group:not(:first-child), { + > .btn:not(:first-child), + > .btn-group:not(:first-child), { margin-left: -$btn-border-width; } @@ -107,8 +107,8 @@ align-items: flex-start; justify-content: center; - .btn, - .btn-group { + > .btn, + > .btn-group { width: 100%; } From 88a1d905f7cf6fbdd39b314ece5abffaa8142411 Mon Sep 17 00:00:00 2001 From: ysds Date: Fri, 2 Nov 2018 15:04:18 +0900 Subject: [PATCH 4/5] Remove unnecessary comma --- scss/_button-group.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scss/_button-group.scss b/scss/_button-group.scss index 2e62451cbc75..2339ed6af53a 100644 --- a/scss/_button-group.scss +++ b/scss/_button-group.scss @@ -38,7 +38,7 @@ .btn-group { // Prevent double borders when buttons are next to each other > .btn:not(:first-child), - > .btn-group:not(:first-child), { + > .btn-group:not(:first-child) { margin-left: -$btn-border-width; } From d4eb1458be97d57311f9eba055bf223c99e456fc Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Fri, 2 Nov 2018 08:10:31 +0200 Subject: [PATCH 5/5] Update _button-group.scss --- scss/_button-group.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scss/_button-group.scss b/scss/_button-group.scss index 2339ed6af53a..716cf5208a9f 100644 --- a/scss/_button-group.scss +++ b/scss/_button-group.scss @@ -119,7 +119,7 @@ } > .btn:not(:first-child), - > .btn-group:not(:first-child), { + > .btn-group:not(:first-child) { margin-top: -$btn-border-width; }