cleanup + fixes
This commit is contained in:
parent
4887d37110
commit
5a085d8e36
8 changed files with 119 additions and 81 deletions
|
@ -48,13 +48,15 @@
|
||||||
border-top: 1px solid var(--border);
|
border-top: 1px solid var(--border);
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropdown-item:not(button, a) {
|
.dropdown-item {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|
||||||
|
.popover-wrapper {
|
||||||
|
box-sizing: border-box;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.dropdown-item,
|
|
||||||
button.dropdown-item,
|
|
||||||
.dropdown-item:not(button, a) {
|
|
||||||
.extra-button {
|
.extra-button {
|
||||||
border-left: 1px solid var(--icon);
|
border-left: 1px solid var(--icon);
|
||||||
padding-left: calc(var(--__horizontal-gap) - 1px);
|
padding-left: calc(var(--__horizontal-gap) - 1px);
|
||||||
|
@ -64,6 +66,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-button {
|
.main-button {
|
||||||
|
width: 100%;
|
||||||
padding: var(--__horizontal-gap) var(--__horizontal-gap);
|
padding: var(--__horizontal-gap) var(--__horizontal-gap);
|
||||||
grid-gap: var(--__horizontal-gap);
|
grid-gap: var(--__horizontal-gap);
|
||||||
grid-template-columns: 1fr var(--__line-height);
|
grid-template-columns: 1fr var(--__line-height);
|
||||||
|
@ -125,5 +128,11 @@
|
||||||
padding-left: calc(var(--__line-height) + var(--__horizontal-gap) * 2);
|
padding-left: calc(var(--__line-height) + var(--__horizontal-gap) * 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.-icon-double {
|
||||||
|
.main-button {
|
||||||
|
grid-template-columns: var(--__line-height) var(--__line-height) 1fr;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<span
|
<span
|
||||||
|
class="popover-wrapper"
|
||||||
@mouseenter="onMouseenter"
|
@mouseenter="onMouseenter"
|
||||||
@mouseleave="onMouseleave"
|
@mouseleave="onMouseleave"
|
||||||
>
|
>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
role="menu"
|
role="menu"
|
||||||
>
|
>
|
||||||
<div role="group">
|
<div role="group">
|
||||||
<div class="menu-item dropdown-item -icon">
|
<div class="menu-item dropdown-item -icon-double">
|
||||||
<button
|
<button
|
||||||
class="main-button"
|
class="main-button"
|
||||||
:aria-checked="conversationDisplay === 'tree'"
|
:aria-checked="conversationDisplay === 'tree'"
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
/> {{ $t('settings.conversation_display_tree_quick') }}
|
/> {{ $t('settings.conversation_display_tree_quick') }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="menu-item dropdown-item -icon">
|
<div class="menu-item dropdown-item -icon-double">
|
||||||
<button
|
<button
|
||||||
class="main-button"
|
class="main-button"
|
||||||
:aria-checked="conversationDisplay === 'linear'"
|
:aria-checked="conversationDisplay === 'linear'"
|
||||||
|
|
56
src/components/status_action_buttons/action_button.scss
Normal file
56
src/components/status_action_buttons/action_button.scss
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
@import "../../mixins";
|
||||||
|
/* stylelint-disable declaration-no-important */
|
||||||
|
|
||||||
|
.action-button {
|
||||||
|
&.-quick {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: max-content auto;
|
||||||
|
grid-gap: 1em;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.disabled {
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover,
|
||||||
|
&.-active {
|
||||||
|
&.reply-button:not(.disabled) {
|
||||||
|
.svg-inline--fa {
|
||||||
|
color: var(--cBlue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.retweet-button:not(.disabled) {
|
||||||
|
.svg-inline--fa {
|
||||||
|
color: var(--cGreen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.favorite-button:not(.disabled) {
|
||||||
|
.svg-inline--fa {
|
||||||
|
color: var(--cOrange);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@include unfocused-style {
|
||||||
|
.focus-marker {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.active-marker {
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@include focused-style {
|
||||||
|
.focus-marker {
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
.active-marker {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,10 +2,11 @@
|
||||||
<div>
|
<div>
|
||||||
<component
|
<component
|
||||||
:is="getComponent(button)"
|
:is="getComponent(button)"
|
||||||
class="main-button"
|
class="main-button action-button"
|
||||||
|
:class="buttonClass"
|
||||||
role="menuitem"
|
role="menuitem"
|
||||||
:tabindex="0"
|
:tabindex="0"
|
||||||
:disabled="getClass(button).disabled"
|
:disabled="buttonClass.disabled"
|
||||||
:href="getComponent(button) == 'a' ? button.link?.(funcArg) || getRemoteInteractionLink : undefined"
|
:href="getComponent(button) == 'a' ? button.link?.(funcArg) || getRemoteInteractionLink : undefined"
|
||||||
@click.stop="getComponent(button) === 'button' && doAction(button)"
|
@click.stop="getComponent(button) === 'button' && doAction(button)"
|
||||||
@click="close"
|
@click="close"
|
||||||
|
@ -15,25 +16,25 @@
|
||||||
class="fa-scale-110"
|
class="fa-scale-110"
|
||||||
:icon="button.icon(funcArg)"
|
:icon="button.icon(funcArg)"
|
||||||
:spin="!extra && button.animated?.() && animationState[button.name]"
|
:spin="!extra && button.animated?.() && animationState[button.name]"
|
||||||
:fixed-width="extra"
|
fixed-width
|
||||||
/>
|
/>
|
||||||
<template v-if="!getClass(button).disabled && button.toggleable?.(funcArg) && button.active">
|
<template v-if="!buttonClass.disabled && button.toggleable?.(funcArg) && button.active">
|
||||||
<FAIcon
|
<FAIcon
|
||||||
v-if="button.active(funcArg)"
|
v-if="button.active(funcArg)"
|
||||||
class="active-marker"
|
class="active-marker"
|
||||||
transform="shrink-6 up-9 right-12"
|
transform="shrink-6 up-9 right-15"
|
||||||
:icon="button.activeIndicator?.(funcArg) || 'check'"
|
:icon="button.activeIndicator?.(funcArg) || 'check'"
|
||||||
/>
|
/>
|
||||||
<FAIcon
|
<FAIcon
|
||||||
v-if="!button.active(funcArg)"
|
v-if="!button.active(funcArg)"
|
||||||
class="focus-marker"
|
class="focus-marker"
|
||||||
transform="shrink-6 up-9 right-12"
|
transform="shrink-6 up-9 right-15"
|
||||||
:icon="button.openIndicator?.(funcArg) || 'plus'"
|
:icon="button.openIndicator?.(funcArg) || 'plus'"
|
||||||
/>
|
/>
|
||||||
<FAIcon
|
<FAIcon
|
||||||
v-else
|
v-else
|
||||||
class="focus-marker"
|
class="focus-marker"
|
||||||
transform="shrink-6 up-9 right-12"
|
transform="shrink-6 up-9 right-15"
|
||||||
:icon="button.closeIndicator?.(funcArg) || 'minus'"
|
:icon="button.closeIndicator?.(funcArg) || 'minus'"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
@ -108,6 +109,19 @@ export default {
|
||||||
'getComponent',
|
'getComponent',
|
||||||
'doAction',
|
'doAction',
|
||||||
'close'
|
'close'
|
||||||
]
|
],
|
||||||
|
computed: {
|
||||||
|
buttonClass () {
|
||||||
|
return {
|
||||||
|
[this.button.name + '-button']: true,
|
||||||
|
'-extra': this.extra,
|
||||||
|
'-quick': !this.extra,
|
||||||
|
'-active': this.button.active?.(this.funcArg),
|
||||||
|
disabled: this.button.interactive ? !this.button.interactive(this.funcArg) : false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" src="./action_button.scss"/>
|
||||||
|
|
|
@ -159,8 +159,8 @@ const BUTTONS = [{
|
||||||
name: 'pin',
|
name: 'pin',
|
||||||
icon: 'thumbtack',
|
icon: 'thumbtack',
|
||||||
label: ({ status }) => status.pinned
|
label: ({ status }) => status.pinned
|
||||||
? 'status.pin'
|
? 'status.unpin'
|
||||||
: 'status.unpin',
|
: 'status.pin',
|
||||||
if ({ status, loggedIn, currentUser }) {
|
if ({ status, loggedIn, currentUser }) {
|
||||||
return loggedIn &&
|
return loggedIn &&
|
||||||
status.user.id === currentUser.id &&
|
status.user.id === currentUser.id &&
|
||||||
|
@ -179,9 +179,11 @@ const BUTTONS = [{
|
||||||
// =========
|
// =========
|
||||||
name: 'bookmark',
|
name: 'bookmark',
|
||||||
icon: 'bookmark',
|
icon: 'bookmark',
|
||||||
|
toggleable: true,
|
||||||
|
active: ({ status }) => status.bookmarked,
|
||||||
label: ({ status }) => status.bookmarked
|
label: ({ status }) => status.bookmarked
|
||||||
? 'status.bookmark'
|
? 'status.unbookmark'
|
||||||
: 'status.unbookmark',
|
: 'status.bookmark',
|
||||||
if: ({ loggedIn }) => loggedIn,
|
if: ({ loggedIn }) => loggedIn,
|
||||||
action ({ status, dispatch, emit }) {
|
action ({ status, dispatch, emit }) {
|
||||||
if (status.bookmarked) {
|
if (status.bookmarked) {
|
||||||
|
|
|
@ -13,17 +13,6 @@
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr auto;
|
grid-template-columns: 1fr auto;
|
||||||
|
|
||||||
.action-button {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: max-content auto;
|
|
||||||
grid-gap: 1em;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
&.disabled {
|
|
||||||
cursor: not-allowed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&.-pin {
|
&.-pin {
|
||||||
margin: calc(-2px - 0.25em);
|
margin: calc(-2px - 0.25em);
|
||||||
padding: 0.25em;
|
padding: 0.25em;
|
||||||
|
@ -106,56 +95,6 @@
|
||||||
padding: var(--__horizontal-gap) var(--__horizontal-gap);
|
padding: var(--__horizontal-gap) var(--__horizontal-gap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
> a,
|
|
||||||
> button {
|
|
||||||
@include unfocused-style {
|
|
||||||
.focus-marker {
|
|
||||||
visibility: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.active-marker {
|
|
||||||
visibility: visible;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@include focused-style {
|
|
||||||
.focus-marker {
|
|
||||||
visibility: visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
.active-marker {
|
|
||||||
visibility: hidden;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.reply-button:not(.disabled) {
|
|
||||||
&:hover,
|
|
||||||
&.-active {
|
|
||||||
.svg-inline--fa {
|
|
||||||
color: var(--cBlue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.retweet-button:not(.disabled) {
|
|
||||||
&:hover,
|
|
||||||
&.-active {
|
|
||||||
.svg-inline--fa {
|
|
||||||
color: var(--cGreen);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.favorite-button:not(.disabled) {
|
|
||||||
&:hover,
|
|
||||||
&.-active {
|
|
||||||
.svg-inline--fa {
|
|
||||||
color: var(--cOrange);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* stylelint-enable no-descending-specificity */
|
/* stylelint-enable no-descending-specificity */
|
||||||
|
|
|
@ -130,7 +130,24 @@
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #content>
|
<template #content>
|
||||||
<StatusBookmarkFolderMenu v-if="button.name === 'mute'" :status="funcArg.status" />
|
<template v-if="button.name === 'mute'">
|
||||||
|
<div
|
||||||
|
v-for="folder in folders"
|
||||||
|
:key="folder.id"
|
||||||
|
class="menu-item dropdown-item -icon"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
class="main-button"
|
||||||
|
@click="toggleFolder(folder.id)"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="input menu-checkbox -radio"
|
||||||
|
:class="{ 'menu-checkbox-checked': status.bookmark_folder_id == folder.id }"
|
||||||
|
/>
|
||||||
|
{{ folder.name }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</Popover>
|
</Popover>
|
||||||
<Popover
|
<Popover
|
||||||
|
|
Loading…
Add table
Reference in a new issue