api-client/components/button/Secondary.vue

141 lines
2.6 KiB
Vue
Raw Normal View History

2021-07-02 05:01:29 +00:00
<template>
<SmartLink
:to="`${/^\/(?!\/).*$/.test(to) ? localePath(to) : to}`"
:exact="exact"
:blank="blank"
class="
2021-07-17 17:40:28 +00:00
font-semibold
py-2
transition
2021-07-02 05:01:29 +00:00
inline-flex
items-center
justify-center
focus:outline-none
hover:bg-primaryDark
2021-07-02 05:01:29 +00:00
"
:class="[
color
2021-07-08 07:30:41 +00:00
? `text-${color}-400 hover:text-${color}-600 focus:text-${color}-600`
: 'text-secondary hover:text-secondaryDark focus:text-secondaryDark',
label ? 'px-4' : 'px-2',
rounded ? 'rounded-full' : 'rounded',
2021-07-24 16:46:48 +00:00
{ 'opacity-75 cursor-not-allowed': disabled },
2021-07-02 05:01:29 +00:00
{ 'flex-row-reverse': reverse },
{ 'px-6 py-4 text-lg': large },
2021-07-02 05:01:29 +00:00
{
'border border-divider hover:border-dividerDark focus:border-dividerDark':
outline,
},
]"
:disabled="disabled"
>
<i
v-if="icon"
2021-07-30 08:22:43 +00:00
:class="[
'material-icons',
{ '!text-2xl': large },
label ? (reverse ? 'ml-2' : 'mr-2') : '',
]"
2021-07-02 05:01:29 +00:00
>
{{ icon }}
</i>
<SmartIcon
v-if="svg"
:name="svg"
2021-07-30 08:22:43 +00:00
:class="[
'svg-icons',
{ '!h-6 !w-6': large },
label ? (reverse ? 'ml-2' : 'mr-2') : '',
]"
2021-07-02 05:01:29 +00:00
/>
{{ label }}
<div v-if="shortcut.length && SHORTCUT_INDICATOR" class="ml-2">
2021-07-17 17:40:28 +00:00
<kbd
v-for="(key, index) in shortcut"
2021-07-17 17:40:28 +00:00
:key="`key-${index}`"
class="
bg-dividerLight
rounded
text-secondaryLight
ml-1
px-1
inline-flex
"
>
{{ key }}
</kbd>
</div>
2021-07-02 05:01:29 +00:00
</SmartLink>
</template>
<script>
2021-07-19 16:42:56 +00:00
import { getSettingSubject } from "~/newstore/settings"
2021-07-02 05:01:29 +00:00
export default {
props: {
to: {
type: String,
default: "",
},
exact: {
type: Boolean,
default: true,
},
blank: {
type: Boolean,
default: false,
},
label: {
type: String,
default: "",
},
icon: {
type: String,
default: "",
},
svg: {
type: String,
default: "",
},
color: {
type: String,
default: "",
},
disabled: {
type: Boolean,
default: false,
},
reverse: {
type: Boolean,
default: false,
},
rounded: {
type: Boolean,
default: false,
},
large: {
type: Boolean,
default: false,
},
2021-07-02 05:01:29 +00:00
outline: {
type: Boolean,
default: false,
},
shortcut: {
2021-07-17 17:40:28 +00:00
type: Array,
default: () => [],
},
2021-07-02 05:01:29 +00:00
},
2021-07-19 16:42:56 +00:00
data() {
return {
SHORTCUT_INDICATOR: null,
2021-07-19 16:42:56 +00:00
}
},
subscriptions() {
return {
SHORTCUT_INDICATOR: getSettingSubject("SHORTCUT_INDICATOR"),
2021-07-19 16:42:56 +00:00
}
},
2021-07-02 05:01:29 +00:00
}
</script>