From f9b0cd75a7b5edaddfd174c8e666d6cf95f3406b Mon Sep 17 00:00:00 2001 From: Houston Blyden Date: Tue, 30 Nov 2021 13:33:14 +0000 Subject: [PATCH] fix: button alignment (#897) * update other files * Child select col elements * remove commented text --- .../sass/styles/wmnds-grid/_wmnds-grid.scss | 2 +- src/wmnds/components/button/_button.njk | 2 +- src/wmnds/components/button/_button.scss | 42 ++++++++++++++++--- src/wmnds/patterns/footer/_footer.scss | 2 +- src/wmnds/patterns/header-v2/_header-v2.scss | 1 + 5 files changed, 40 insertions(+), 9 deletions(-) diff --git a/src/wmnds/assets/sass/styles/wmnds-grid/_wmnds-grid.scss b/src/wmnds/assets/sass/styles/wmnds-grid/_wmnds-grid.scss index 6cdf1bec6..7cb09f0d4 100644 --- a/src/wmnds/assets/sass/styles/wmnds-grid/_wmnds-grid.scss +++ b/src/wmnds/assets/sass/styles/wmnds-grid/_wmnds-grid.scss @@ -21,7 +21,7 @@ -ms-flex-line-pack: start; align-content: flex-start; - [class*="wmnds-col-"] { + & > [class*="wmnds-col-"] { display: inline-block; zoom: 1; letter-spacing: normal; diff --git a/src/wmnds/components/button/_button.njk b/src/wmnds/components/button/_button.njk index 29e931e4f..3f4bf6395 100644 --- a/src/wmnds/components/button/_button.njk +++ b/src/wmnds/components/button/_button.njk @@ -23,7 +23,7 @@ {{ wmndsIcon({ icon: iconLeft, - class: ('wmnds-btn__icon '+iconClasses) + class: ('wmnds-btn__icon wmnds-btn__icon--left '+iconClasses) }) }} diff --git a/src/wmnds/components/button/_button.scss b/src/wmnds/components/button/_button.scss index 622cb018c..ea17b77cf 100644 --- a/src/wmnds/components/button/_button.scss +++ b/src/wmnds/components/button/_button.scss @@ -5,9 +5,10 @@ $btn-transition: ease-in-out background-color 0.2s, ease-in-out border 0.2s; // default button styles aka cta btn &.wmnds-btn { box-sizing: border-box; - display: inline-block; + display: inline-flex; position: relative; - padding: $size-sm; + min-height: 50px; + padding: $size-xs $size-xsm; transition: $btn-transition; border: 1px solid transparent; border-radius: $btn-border-radius; @@ -15,9 +16,11 @@ $btn-transition: ease-in-out background-color 0.2s, ease-in-out border 0.2s; background-color: get-color(cta); font-size: 1rem; font-weight: bold; - text-align: center; + line-height: 1.3rem; text-decoration: none; cursor: pointer; + align-items: center; + justify-content: space-between; &:hover { background-color: get-color(cta, 30, dark); @@ -37,7 +40,12 @@ $btn-transition: ease-in-out background-color 0.2s, ease-in-out border 0.2s; width: 22px; height: 22px; fill: $white; - vertical-align: top; + flex: 0 0 22px; + } + + // button icon left style + &__icon--left { + margin-right: $size-xs; } .wmnds-swift-logo-inline { @@ -47,7 +55,6 @@ $btn-transition: ease-in-out background-color 0.2s, ease-in-out border 0.2s; // button icon right style &__icon--right { margin-left: $size-sm; - float: right; } // Dark background variant @@ -204,6 +211,16 @@ $btn-transition: ease-in-out background-color 0.2s, ease-in-out border 0.2s; fill: get-color(primary); } + &:not(.wmnds-text-align-left), + &:not(.wmnds-text-align-center), + &:not(.wmnds-text-align-right) { + justify-content: flex-start; + + .wmnds-btn__icon--right { + margin-left: auto; + } + } + .wmnds-btn__coloured-icon { &--bus { fill: get-color(bus); @@ -294,7 +311,6 @@ $btn-transition: ease-in-out background-color 0.2s, ease-in-out border 0.2s; // block modifier for full width buttons &--block { - display: block; width: 100%; } @@ -303,9 +319,23 @@ $btn-transition: ease-in-out background-color 0.2s, ease-in-out border 0.2s; text-align: left; } + // include helpers for button alignment + &.wmnds-text-align-left { + justify-content: flex-start; + } + + &.wmnds-text-align-center { + justify-content: center; + } + + &.wmnds-text-align-right { + justify-content: flex-end; + } + // Show button like a normal link modifier &--link { display: inline; + min-height: 0; padding: 0; border-radius: 0; color: get-color(cta, 10, dark); diff --git a/src/wmnds/patterns/footer/_footer.scss b/src/wmnds/patterns/footer/_footer.scss index f68f6225f..0cf209306 100644 --- a/src/wmnds/patterns/footer/_footer.scss +++ b/src/wmnds/patterns/footer/_footer.scss @@ -31,7 +31,7 @@ padding: $size-lg $size-xs; .wmnds-btn { - display: block; + width: 100%; color: get-color(primary); background-color: $white; } diff --git a/src/wmnds/patterns/header-v2/_header-v2.scss b/src/wmnds/patterns/header-v2/_header-v2.scss index 9be607cec..55aef0bd6 100644 --- a/src/wmnds/patterns/header-v2/_header-v2.scss +++ b/src/wmnds/patterns/header-v2/_header-v2.scss @@ -231,6 +231,7 @@ $header-height-mobile: 4rem; display: block; z-index: 100; height: 2.25rem; + min-height: 0; padding: 0 1.35rem; border-color: $white; color: $white;