improve scope selector
This commit is contained in:
parent
fba7d15a2c
commit
b0f725671a
3 changed files with 41 additions and 18 deletions
|
|
@ -104,8 +104,8 @@
|
||||||
.visibility-tray {
|
.visibility-tray {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding-top: 0.5em;
|
|
||||||
align-items: baseline;
|
align-items: baseline;
|
||||||
|
margin-left: -0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.visibility-notice {
|
.visibility-notice {
|
||||||
|
|
|
||||||
|
|
@ -14,13 +14,33 @@ library.add(
|
||||||
)
|
)
|
||||||
|
|
||||||
const ScopeSelector = {
|
const ScopeSelector = {
|
||||||
props: [
|
props: {
|
||||||
'showAll',
|
showAll: {
|
||||||
'userDefault',
|
required: true,
|
||||||
'originalScope',
|
type: Boolean
|
||||||
'initialScope',
|
},
|
||||||
'onScopeChange'
|
userDefault: {
|
||||||
],
|
required: true,
|
||||||
|
type: String
|
||||||
|
},
|
||||||
|
originalScope: {
|
||||||
|
required: false,
|
||||||
|
type: String
|
||||||
|
},
|
||||||
|
initialScope: {
|
||||||
|
required: false,
|
||||||
|
type: String
|
||||||
|
},
|
||||||
|
onScopeChange: {
|
||||||
|
required: true,
|
||||||
|
type: Function
|
||||||
|
},
|
||||||
|
unstyled: {
|
||||||
|
required: false,
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
}
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
currentScope: this.initialScope
|
currentScope: this.initialScope
|
||||||
|
|
@ -43,11 +63,12 @@ const ScopeSelector = {
|
||||||
return this.shouldShow('direct')
|
return this.shouldShow('direct')
|
||||||
},
|
},
|
||||||
css () {
|
css () {
|
||||||
|
const style = this.unstyled ? 'button-unstyled' : 'button-default'
|
||||||
return {
|
return {
|
||||||
public: { toggled: this.currentScope === 'public' },
|
public: [style, { toggled: this.currentScope === 'public' }],
|
||||||
unlisted: { toggled: this.currentScope === 'unlisted' },
|
unlisted: [style, { toggled: this.currentScope === 'unlisted' }],
|
||||||
private: { toggled: this.currentScope === 'private' },
|
private: [style, { toggled: this.currentScope === 'private' }],
|
||||||
direct: { toggled: this.currentScope === 'direct' }
|
direct: [style, { toggled: this.currentScope === 'direct' }]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
v-if="!showNothing"
|
v-if="!showNothing"
|
||||||
class="ScopeSelector"
|
class="ScopeSelector btn-group"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
v-if="showDirect"
|
v-if="showDirect"
|
||||||
class="button-unstyled scope"
|
class="scope"
|
||||||
:class="css.direct"
|
:class="css.direct"
|
||||||
:title="$t('post_status.scope.direct')"
|
:title="$t('post_status.scope.direct')"
|
||||||
type="button"
|
type="button"
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
{{ ' ' }}
|
{{ ' ' }}
|
||||||
<button
|
<button
|
||||||
v-if="showPrivate"
|
v-if="showPrivate"
|
||||||
class="button-unstyled scope"
|
class="scope"
|
||||||
:class="css.private"
|
:class="css.private"
|
||||||
:title="$t('post_status.scope.private')"
|
:title="$t('post_status.scope.private')"
|
||||||
type="button"
|
type="button"
|
||||||
|
|
@ -33,7 +33,7 @@
|
||||||
{{ ' ' }}
|
{{ ' ' }}
|
||||||
<button
|
<button
|
||||||
v-if="showUnlisted"
|
v-if="showUnlisted"
|
||||||
class="button-unstyled scope"
|
class="scope"
|
||||||
:class="css.unlisted"
|
:class="css.unlisted"
|
||||||
:title="$t('post_status.scope.unlisted')"
|
:title="$t('post_status.scope.unlisted')"
|
||||||
type="button"
|
type="button"
|
||||||
|
|
@ -47,7 +47,7 @@
|
||||||
{{ ' ' }}
|
{{ ' ' }}
|
||||||
<button
|
<button
|
||||||
v-if="showPublic"
|
v-if="showPublic"
|
||||||
class="button-unstyled scope"
|
class="scope"
|
||||||
:class="css.public"
|
:class="css.public"
|
||||||
:title="$t('post_status.scope.public')"
|
:title="$t('post_status.scope.public')"
|
||||||
type="button"
|
type="button"
|
||||||
|
|
@ -65,12 +65,14 @@
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.ScopeSelector {
|
.ScopeSelector {
|
||||||
|
display: inline-block;
|
||||||
|
|
||||||
.scope {
|
.scope {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
cursor: pointer;
|
|
||||||
min-width: 1.3em;
|
min-width: 1.3em;
|
||||||
min-height: 1.3em;
|
min-height: 1.3em;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
padding: 0.5em 0.25em
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue