REFACTOR: Consistency, A11Y, and less text for composer toggles (#12627)

This commit is contained in:
Kris 2021-04-07 16:15:07 -04:00 committed by GitHub
parent 72ff9e817c
commit ea2105f3e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 57 additions and 24 deletions

View File

@ -2,24 +2,27 @@
{{plugin-outlet name="before-composer-toggles"}} {{plugin-outlet name="before-composer-toggles"}}
{{#if site.mobileView}} {{#if site.mobileView}}
{{flat-button {{d-button
class="toggle-toolbar" class="btn-flat toggle-toolbar btn-mini-toggle"
icon="bars" icon="bars"
action=toggleToolbar action=toggleToolbar
title=toggleToolbarTitle}} title=toggleToolbarTitle
ariaLabel=toggleToolbarTitle}}
{{/if}} {{/if}}
{{flat-button {{d-button
class="toggler" class="btn-flat toggler toggle-minimize btn-mini-toggle"
icon=toggleIcon icon=toggleIcon
action=toggleComposer action=toggleComposer
title=toggleTitle}} title=toggleTitle
ariaLabel=toggleTitle}}
{{#unless site.mobileView}} {{#unless site.mobileView}}
{{flat-button {{d-button
class="toggle-fullscreen" class="btn-flat toggle-fullscreen btn-mini-toggle"
icon=fullscreenIcon icon=fullscreenIcon
action=toggleFullscreen action=toggleFullscreen
title=fullscreenTitle}} title=fullscreenTitle
ariaLabel=fullscreenTitle}}
{{/unless}} {{/unless}}
</div> </div>

View File

@ -207,7 +207,13 @@
{{d-button action=(action "togglePreview") class="hide-preview" ariaLabel="composer.hide_preview" icon="pencil-alt"}} {{d-button action=(action "togglePreview") class="hide-preview" ariaLabel="composer.hide_preview" icon="pencil-alt"}}
{{/if}} {{/if}}
{{else}} {{else}}
<a href {{action "togglePreview"}} class="toggle-preview">{{html-safe toggleText}}</a> {{d-button
action=(action "togglePreview")
translatedTitle=toggleText
translatedAriaLabel=toggleText
icon="angle-double-left"
class=(concat "btn-flat btn-mini-toggle toggle-preview " (unless showPreview "active"))
}}
{{/if}} {{/if}}
</div> </div>

View File

@ -83,7 +83,7 @@
.saving-text { .saving-text {
display: none; display: none;
} }
.toggler { .toggle-minimize {
order: 2; order: 2;
} }
} }
@ -97,9 +97,7 @@
margin: 5px 0 10px 0; margin: 5px 0 10px 0;
display: flex; display: flex;
align-items: center; align-items: center;
.d-icon {
color: var(--primary-high);
}
.reply-details { .reply-details {
max-width: calc(100% - 175px); max-width: calc(100% - 175px);
flex: 1 1 auto; flex: 1 1 auto;
@ -108,7 +106,7 @@
white-space: nowrap; white-space: nowrap;
.d-icon { .d-icon {
opacity: 0.8; color: var(--primary-medium);
} }
} }
.composer-action-title { .composer-action-title {
@ -152,11 +150,8 @@
.composer-controls { .composer-controls {
display: flex; display: flex;
margin-left: auto; margin-left: auto;
button { .toggle-minimize {
padding: 5px 7px; order: 2;
&.toggler {
order: 2;
}
} }
} }
} }
@ -538,3 +533,10 @@ body:not(.ios-safari-composer-hacks) {
} }
} }
} }
.toggle-preview {
transition: all 0.33s ease-out;
&.active {
transform: rotate(180deg);
}
}

View File

@ -264,6 +264,9 @@
line-height: $line-height-small; line-height: $line-height-small;
} }
// Bonus Buttons
// --------------------------------------------------
.btn-flat { .btn-flat {
background: transparent; background: transparent;
border: 0; border: 0;
@ -309,3 +312,22 @@
padding: 0; padding: 0;
color: var(--tertiary); color: var(--tertiary);
} }
.btn-mini-toggle {
padding: 0.4em 0.467em;
.d-icon {
color: var(--primary-high);
}
@include hover {
background: transparent;
.d-icon {
color: var(--primary);
}
}
&:focus {
background: var(--primary-low);
.d-icon {
color: var(--primary);
}
}
}

View File

@ -56,7 +56,7 @@
} }
} }
.toggler { .toggle-minimize {
.d-icon-chevron-down { .d-icon-chevron-down {
vertical-align: text-top; vertical-align: text-top;
} }
@ -67,7 +67,7 @@
padding-bottom: env(safe-area-inset-bottom); padding-bottom: env(safe-area-inset-bottom);
.toggle-toolbar, .toggle-toolbar,
.toggler { .toggle-minimize {
top: 8px; top: 8px;
} }
.draft-text { .draft-text {

View File

@ -2028,8 +2028,8 @@ en:
saved: "Saved!" saved: "Saved!"
saved_draft: "Post draft in progress. Tap to resume." saved_draft: "Post draft in progress. Tap to resume."
uploading: "Uploading..." uploading: "Uploading..."
show_preview: "show preview &raquo;" show_preview: "show preview"
hide_preview: "&laquo; hide preview" hide_preview: "hide preview"
quote_post_title: "Quote whole post" quote_post_title: "Quote whole post"
bold_label: "B" bold_label: "B"