Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: button alignment #897

Merged
merged 5 commits into from
Nov 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/wmnds/assets/sass/styles/wmnds-grid/_wmnds-grid.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/wmnds/components/button/_button.njk
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{{
wmndsIcon({
icon: iconLeft,
class: ('wmnds-btn__icon '+iconClasses)
class: ('wmnds-btn__icon wmnds-btn__icon--left '+iconClasses)
})
}}

Expand Down
42 changes: 36 additions & 6 deletions src/wmnds/components/button/_button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,22 @@ $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;
color: $white;
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);
Expand All @@ -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 {
Expand All @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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%;
}

Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/wmnds/patterns/footer/_footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
padding: $size-lg $size-xs;

.wmnds-btn {
display: block;
width: 100%;
color: get-color(primary);
background-color: $white;
}
Expand Down
1 change: 1 addition & 0 deletions src/wmnds/patterns/header-v2/_header-v2.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down