REFACTOR: Convert buttons to flexbox (#11785)

This commit is contained in:
Kris
2021-01-27 16:17:08 -05:00
committed by GitHub
parent 809274fe0d
commit f1d5d2b134
18 changed files with 67 additions and 69 deletions

View File

@ -6,4 +6,4 @@
{{/each}} {{/each}}
</div> </div>
<div class="instructions">{{i18n "user.ignored_users_instructions"}}</div> <div class="instructions">{{i18n "user.ignored_users_instructions"}}</div>
<div>{{#d-button action=(action "newIgnoredUser") class="btn-default" icon="plus"}}{{i18n "user.user_notifications.add_ignored_user"}}{{/d-button}}</div> <div>{{d-button action=(action "newIgnoredUser") class="btn-default" icon="plus" label="user.user_notifications.add_ignored_user"}}</div>

View File

@ -89,16 +89,18 @@
</div> </div>
</section> </section>
{{d-button <div class="tag-group-controls">
class="btn-default" {{d-button
action=(action "save") class="btn-default"
disabled=savingDisabled action=(action "save")
label="tagging.groups.save"}} disabled=savingDisabled
label="tagging.groups.save"}}
{{d-button {{d-button
class="btn-danger" class="btn-danger"
action=(action "destroy") action=(action "destroy")
disabled=buffered.isNew disabled=buffered.isNew
icon="far-trash-alt" icon="far-trash-alt"
label="tagging.groups.delete"}} label="tagging.groups.delete"}}
</div>
</div> </div>

View File

@ -67,7 +67,7 @@
</li> </li>
{{/if}} {{/if}}
{{#if currentUser.staff}} {{#if currentUser.staff}}
<li><a href={{model.adminPath}} class="btn btn-default">{{d-icon "wrench"}}{{i18n "admin.user.show_admin_profile"}}</a></li> <li><a href={{model.adminPath}} class="btn btn-default">{{d-icon "wrench"}}<span class="d-button-label">{{i18n "admin.user.show_admin_profile"}}</span></a></li>
{{/if}} {{/if}}
{{plugin-outlet name="user-profile-controls" {{plugin-outlet name="user-profile-controls"
tagName="" tagName=""

View File

@ -34,18 +34,6 @@
max-height: 40vh; max-height: 40vh;
} }
} }
@include breakpoint(medium) {
// hide button labels to save space
.btn {
.d-button-label {
display: none;
}
.d-icon {
margin: 0;
}
}
}
} }
.navigation-container { .navigation-container {
@ -81,6 +69,14 @@
> * { > * {
white-space: nowrap; white-space: nowrap;
} }
.select-kit button {
height: 100%; // ensures nested select-kit button matches height of button siblings
}
.btn {
// need to reduce vertical padding for consistent height
padding-top: 0.3em;
padding-bottom: 0.3em;
}
} }
.show-more { .show-more {

View File

@ -122,6 +122,7 @@
} }
.action-title { .action-title {
line-height: normal;
@include ellipsis; @include ellipsis;
} }

View File

@ -162,14 +162,22 @@
} }
.modal-footer { .modal-footer {
display: flex;
flex-wrap: wrap;
align-items: center;
padding: 14px 15px 10px; padding: 14px 15px 10px;
border-top: 1px solid var(--primary-low); border-top: 1px solid var(--primary-low);
.btn { .btn {
margin: 0 5px 5px 0; margin: 0 0.3em 0 0;
&[href] { &[href] {
min-height: unset; min-height: unset;
} }
} }
.btn,
a {
margin-bottom: 0.3em;
}
} }
.modal { .modal {

View File

@ -19,12 +19,12 @@
} }
.btn { .btn {
display: flex; justify-content: left;
text-align: left;
background: none; background: none;
width: 100%; width: 100%;
padding: 0.75em; padding: 0.75em;
border-radius: 0; border-radius: 0;
margin: 0;
.d-icon { .d-icon {
color: var(--primary-medium); color: var(--primary-medium);

View File

@ -188,11 +188,6 @@
width: auto; width: auto;
} }
.refresh {
height: 1em;
display: flex;
}
.score-filter { .score-filter {
width: 5em; width: 5em;
} }

View File

@ -11,7 +11,7 @@
.search-bar { .search-bar {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: stretch;
margin-bottom: 1em; margin-bottom: 1em;
.search-query { .search-query {

View File

@ -258,6 +258,9 @@ header .discourse-tag {
margin-bottom: 10px; margin-bottom: 10px;
} }
} }
.tag-group-controls {
display: flex;
}
.group-tags-list .tag-chooser { .group-tags-list .tag-chooser {
width: 100%; width: 100%;
} }

View File

@ -1077,32 +1077,20 @@ a.mention-group {
} }
#topic-footer-buttons { #topic-footer-buttons {
padding: 0.5em 0; padding: 0.75em 0;
.topic-footer-main-buttons { .topic-footer-main-buttons {
margin: 0 0 -0.5em 0;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
> .btn { button {
margin: 0 0.5em 0.5em 0; margin-right: 0.54em;
display: inline-flex; height: 100%; // helps select-kit buttons match height
align-items: center;
.d-button-label {
display: flex;
flex: 1 0 auto;
align-items: center;
}
} }
.topic-admin-menu-button-container { .topic-admin-menu-button-container {
display: inline-flex; display: inline-flex;
} }
.topic-admin-menu-button-container > span:not(:empty) {
margin: 0 0.5em 0.5em 0;
}
} }
.pinned-button:not(.is-hidden) + .topic-notifications-button { .pinned-button:not(.is-hidden) + .topic-notifications-button {

View File

@ -217,7 +217,6 @@
.btn { .btn {
margin-bottom: 10px; margin-bottom: 10px;
line-height: $line-height-medium;
} }
} }

View File

@ -13,25 +13,24 @@
$hover-bg-color: var(--primary-medium), $hover-bg-color: var(--primary-medium),
$hover-icon-color: var(--primary-low) $hover-icon-color: var(--primary-low)
) { ) {
display: inline-block;
margin: 0;
padding: 6px 12px;
min-height: 30px;
border: none;
box-sizing: border-box; box-sizing: border-box;
display: inline-flex;
align-items: center;
justify-content: center;
margin: 0;
padding: 0.53em 0.8em;
border: none;
font-weight: normal; font-weight: normal;
font-size: $font-0;
line-height: normal;
color: $text-color; color: $text-color;
background: $bg-color; background: $bg-color;
font-size: $font-0;
line-height: $line-height-small;
text-align: center;
cursor: pointer; cursor: pointer;
transition: all 0.25s; transition: all 0.25s;
.d-icon { .d-icon {
color: $icon-color; color: $icon-color;
margin-right: 0.45em; margin-right: 0.45em;
transition: color 0.25s; transition: color 0.25s;
line-height: $line-height-medium; // Match button text line-height
} }
&.no-text { &.no-text {
.d-icon { .d-icon {

View File

@ -22,6 +22,7 @@
@extend .clearfix; @extend .clearfix;
> li { > li {
display: flex;
float: left; float: left;
margin-right: 0.5em; margin-right: 0.5em;

View File

@ -263,7 +263,7 @@
// shared styles for all font sizes // shared styles for all font sizes
.btn, .btn,
.btn-default { .btn-default {
padding: 0 0.5em; padding: 0.5em;
} }
.d-editor-spacer { .d-editor-spacer {
margin: 0 0.25em; margin: 0 0.25em;

View File

@ -186,15 +186,11 @@
> ul { > ul {
display: inline-flex; display: inline-flex;
> li { > li {
display: inline; display: inline-flex;
margin-left: 12px; margin-left: 0.75em;
.d-button-label {
line-height: 1;
}
} }
a { a {
margin-bottom: 10px;
width: auto; width: auto;
} }
} }

View File

@ -237,9 +237,19 @@ a.reply-to-tab {
color: var(--tertiary); color: var(--tertiary);
} }
.topic-footer-main-buttons {
display: flex;
align-items: stretch;
}
.topic-footer-mobile-dropdown { .topic-footer-mobile-dropdown {
margin: 0 0.5em 0.5em 0; margin: 0 0.75em 0 0;
width: 160px; width: 160px;
display: flex;
}
.select-kit-header {
height: 100%;
} }
.topic-notifications-button, .topic-notifications-button,

View File

@ -201,7 +201,7 @@
flex: 1; flex: 1;
@include ellipsis; @include ellipsis;
width: 100%; width: 100%;
text-align: left; justify-content: flex-start;
} }
} }