Use proper button groups

Improve styling of button groups, so they're more intuitive. Remove
button-group containers for single buttons.
This commit is contained in:
Basti 2018-04-01 15:25:25 +02:00
parent c979b13df5
commit 5748f83971
3 changed files with 63 additions and 33 deletions

View File

@ -123,7 +123,7 @@ export default Component.extend({
showEditor: false showEditor: false
}); });
}).catch(err => { }).catch(err => {
alert('Failed to update the file. Check the console for more info'); alert('Failed to update the file. Check the console for more info.');
console.error(err); console.error(err);
}); });
} else { } else {

View File

@ -1,24 +1,16 @@
div.button-group {
display: inline-block;
}
div.button-group + button,
div.button-group + div.button-group {
margin-left: 1rem;
}
header { header {
button, a.button { button, a.button {
display: inline-block; display: inline-block;
padding: 0.4rem 0 0.3rem; padding: 0.4rem 0 0.3rem;
text-align: center; width: 3rem;
border: 1px solid $dark-grey-2; border: 1px solid $dark-grey-2;
border-radius: 0.2em; border-radius: 0.2em;
background-color: #fff; background-color: #fff;
color: $dark-grey-2; color: $dark-grey-2;
text-align: center;
font-size: 0.8rem; font-size: 0.8rem;
text-transform: uppercase; text-transform: uppercase;
width: 3rem;
svg { svg {
height: 1rem; height: 1rem;
@ -38,8 +30,8 @@ header {
} }
} }
&:disabled, &:disabled:not(.active),
&:disabled:hover { &:disabled:not(.active):hover {
border-color: $dark-grey-3; border-color: $dark-grey-3;
background-color: #fff; background-color: #fff;
color: $dark-grey-3; color: $dark-grey-3;
@ -50,5 +42,47 @@ header {
} }
} }
} }
&.active {
border-color: lighten($dark-grey-2, 10%);
background-color: lighten($dark-grey-2, 10%);
color: lighten($dark-grey-2, 10%);
svg {
path {
fill: #fff;
} }
}
}
}
button + .button-group,
.button-group + button,
.button-group + .button-group {
margin-left: 1rem;
}
.button-group {
position: relative;
display: inline-flex;
flex-direction: row;
button {
position: relative;
margin-right: 0;
flex: 0 1 auto;
&:not(:last-child) {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
}
button + button {
margin-left: -1px;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
}
} }

View File

@ -1,7 +1,6 @@
<header> <header>
{{breadcrumb-nav currentDirPath=currentDirPath}} {{breadcrumb-nav currentDirPath=currentDirPath}}
<nav class="actions"> <nav class="actions">
<div class="button-group">
{{#if metadataHidden}} {{#if metadataHidden}}
<button {{action "toggleMetadata"}} <button {{action "toggleMetadata"}}
title="Show metadata"> title="Show metadata">
@ -13,14 +12,11 @@
{{partial "icons/arrow-to-right"}} {{partial "icons/arrow-to-right"}}
</button> </button>
{{/if}} {{/if}}
</div>
{{#if publicItemURL}} {{#if publicItemURL}}
<div class="button-group">
<a class="button" href={{publicItemURL}} target="_blank" <a class="button" href={{publicItemURL}} target="_blank"
title="Open document in new tab"> title="Open document in new tab">
{{partial "icons/share"}} {{partial "icons/share"}}
</a> </a>
</div>
{{/if}} {{/if}}
{{#if documentIsJSON}} {{#if documentIsJSON}}
<div class="button-group json-view"> <div class="button-group json-view">