From 7ed3b357aa2ffa5b93de32014711efb513fd1c33 Mon Sep 17 00:00:00 2001 From: Dana Woodman Date: Wed, 21 Sep 2022 02:01:49 -0700 Subject: [PATCH] Fix border radius on mixed type buttons (#1159) * Fix border radius on mixed type buttons Currently, if you have buttons of different types (`a` vs `button` for example), the button styling breaks because the selectors depend on the button type: Change to using child selectors as this doesn't care what type of child exists. * bring back `:not` selectors for button because otherwise, border radius of first and last children will be wrong Co-authored-by: Pouya Saadeghi --- src/utilities/styled/button.css | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/utilities/styled/button.css b/src/utilities/styled/button.css index f6b9dae742a..f105243d9c3 100644 --- a/src/utilities/styled/button.css +++ b/src/utilities/styled/button.css @@ -1,20 +1,20 @@ /* group */ .btn-group, .btn-group.btn-group-horizontal { - .btn:not(:first-of-type):not(:last-of-type) { + .btn:not(:first-child):not(:last-child) { border-top-left-radius: 0; border-top-right-radius: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; } - .btn:first-of-type:not(:last-of-type) { + .btn:first-child:not(:last-child) { @apply -ml-px -mt-0; border-top-left-radius: var(--rounded-btn, 0.5rem); border-top-right-radius: 0; border-bottom-left-radius: var(--rounded-btn, 0.5rem); border-bottom-right-radius: 0; } - .btn:last-of-type:not(:first-of-type) { + .btn:last-child:not(:first-child) { border-top-left-radius: 0; border-top-right-radius: var(--rounded-btn, 0.5rem); border-bottom-left-radius: 0; @@ -22,14 +22,14 @@ } } .btn-group.btn-group-vertical { - .btn:first-of-type:not(:last-of-type) { + .btn:first-child:not(:last-child) { @apply -ml-0 -mt-px; border-top-left-radius: var(--rounded-btn, 0.5rem); border-top-right-radius: var(--rounded-btn, 0.5rem); border-bottom-left-radius: 0; border-bottom-right-radius: 0; } - .btn:last-of-type:not(:first-of-type) { + .btn:last-child:not(:first-child) { border-top-left-radius: 0; border-top-right-radius: 0; border-bottom-left-radius: var(--rounded-btn, 0.5rem);