cleanup + brought back quick actions styles

This commit is contained in:
Henry Jameson 2025-01-14 19:43:47 +02:00
parent 7259817a84
commit 6939405173
6 changed files with 72 additions and 39 deletions

View file

@ -9,12 +9,14 @@ import {
faTimes, faTimes,
faWrench, faWrench,
faChevronRight,
faChevronUp,
faReply, faReply,
faRetweet, faRetweet,
faStar, faStar,
faSmileBeam, faSmileBeam,
faEllipsisH,
faBookmark, faBookmark,
faEyeSlash, faEyeSlash,
faThumbtack, faThumbtack,
@ -33,13 +35,15 @@ library.add(
faTimes, faTimes,
faWrench, faWrench,
faChevronRight,
faChevronUp,
faReply, faReply,
faRetweet, faRetweet,
faStar, faStar,
faStarRegular, faStarRegular,
faSmileBeam, faSmileBeam,
faEllipsisH,
faBookmark, faBookmark,
faEyeSlash, faEyeSlash,
faThumbtack, faThumbtack,
@ -67,14 +71,23 @@ export default {
}, },
computed: { computed: {
buttonClass () { buttonClass () {
if (!this.extra) console.log(this.button.name)
return [
this.button.name + '-button',
{
'-with-extra': this.button.name === 'bookmark',
'-extra': this.extra,
'-quick': !this.extra
}
]
},
buttonInnerClass () {
if (!this.extra) console.log(this.button.name) if (!this.extra) console.log(this.button.name)
return [ return [
this.button.name + '-button', this.button.name + '-button',
{ {
'main-button': this.extra, 'main-button': this.extra,
'button-unstyled': !this.extra, 'button-unstyled': !this.extra,
'-extra': this.extra,
'-quick': !this.extra,
'-active': this.button.active?.(this.funcArg), '-active': this.button.active?.(this.funcArg),
disabled: this.button.interactive ? !this.button.interactive(this.funcArg) : false disabled: this.button.interactive ? !this.button.interactive(this.funcArg) : false
} }

View file

@ -1,41 +1,63 @@
@import "../../mixins"; @import "../../mixins";
/* stylelint-disable declaration-no-important */ /* stylelint-disable declaration-no-important */
.action-button { .quick-action {
display: grid; display: grid;
grid-template-columns: max-content;
grid-gap: 0.25em;
&.-with-extra { &.-pin {
grid-template-columns: 1fr calc(var(--__line-height) + 2 * var(--__horizontal-gap)); margin: calc(-2px - 0.25em);
padding: 0.25em;
border: 2px dashed var(--icon);
border-radius: var(--roundness);
grid-template-columns: 1fr auto;
} }
&.-quick { .action-button-inner,
.extra-button {
margin: -0.5em;
padding: 0.5em;
}
.action-button-inner {
display: grid; display: grid;
grid-template-columns: max-content auto;
grid-gap: 1em; grid-gap: 1em;
grid-template-columns: max-content max-content;
grid-auto-flow: column;
grid-auto-columns: max-content;
align-items: center; align-items: center;
} }
&.disabled { .extra-button {
cursor: not-allowed; border-left: 1px solid var(--icon);
} }
}
&:hover, .action-button {
&.-active { display: grid;
&.reply-button:not(.disabled) { grid-auto-flow: column;
.svg-inline--fa { padding: 0;
color: var(--cBlue);
.action-button-inner {
&:hover,
&.-active {
&.reply-button:not(.disabled) {
.svg-inline--fa {
color: var(--cBlue);
}
} }
}
&.retweet-button:not(.disabled) { &.retweet-button:not(.disabled) {
.svg-inline--fa { .svg-inline--fa {
color: var(--cGreen); color: var(--cGreen);
}
} }
}
&.favorite-button:not(.disabled) { &.favorite-button:not(.disabled) {
.svg-inline--fa { .svg-inline--fa {
color: var(--cOrange); color: var(--cOrange);
}
} }
} }
} }

View file

@ -1,12 +1,12 @@
<template> <template>
<div <div
class="action-button" class="action-button"
:class="{ '-with-extra': button.name === 'bookmark' }" :class="buttonClass"
> >
<component <component
:is="getComponent(button)" :is="getComponent(button)"
class="action-button-inner" class="action-button-inner"
:class="buttonClass" :class="buttonInnerClass"
role="menuitem" role="menuitem"
:tabindex="0" :tabindex="0"
:disabled="buttonClass.disabled" :disabled="buttonClass.disabled"
@ -58,13 +58,13 @@
v-if="button.dropdown?.()" v-if="button.dropdown?.()"
class="chevron-icon" class="chevron-icon"
size="lg" size="lg"
icon="chevron-right" :icon="extra ? 'chevron-right' : 'chevron-up'"
fixed-width fixed-width
/> />
</component> </component>
<Popover <Popover
trigger="hover" trigger="hover"
placement="right" :placement="extra ? 'right' : 'top'"
:trigger-attrs="{ class: 'extra-button' }" :trigger-attrs="{ class: 'extra-button' }"
v-if="button.name === 'bookmark'" v-if="button.name === 'bookmark'"
> >
@ -72,7 +72,7 @@
<FAIcon <FAIcon
class="chevron-icon" class="chevron-icon"
size="lg" size="lg"
icon="chevron-right" :icon="extra ? 'chevron-right' : 'chevron-up'"
fixed-width fixed-width
/> />
</template> </template>

View file

@ -1,14 +1,14 @@
<template> <template>
<Popover <Popover
trigger="hover" trigger="hover"
placement="right" :placement="$attrs.extra ? 'right' : 'top'"
v-if="button.dropdown?.()" v-if="button.dropdown?.()"
> >
<template #trigger> <template #trigger>
{{ props }} {{ props }}
<ActionButton <ActionButton
:button="button" :button="button"
v-bind="$attrs" v-bind.prop="$attrs"
/> />
</template> </template>
<template #content> <template #content>

View file

@ -11,14 +11,11 @@
} }
} }
// popover // popover
/* stylelint-disable no-descending-specificity */
.extra-action-buttons { .extra-action-buttons {
.extra-action { .extra-action {
.pin-action-button { margin: 0;
margin: 0; padding-top: 0;
padding: var(--__horizontal-gap) var(--__horizontal-gap); padding-bottom: 0;
} padding-right: 0;
} }
} }
/* stylelint-enable no-descending-specificity */

View file

@ -8,6 +8,7 @@
:key="button.name" :key="button.name"
> >
<ActionButtonContainer <ActionButtonContainer
:class="{ '-pin': showPin }"
:button="button" :button="button"
:status="status" :status="status"
:extra="false" :extra="false"
@ -92,7 +93,7 @@
<button <button
v-if="showPin && currentUser" v-if="showPin && currentUser"
type="button" type="button"
class="button-unstyled pin-action-button" class="button-unstyled pin-action-button extra-button"
:title="$t('general.pin')" :title="$t('general.pin')"
:aria-pressed="false" :aria-pressed="false"
@click.stop.prevent="pin(button)" @click.stop.prevent="pin(button)"