Files
mixtape/zero.Backoffice.UI/app/components/ui-state-button.vue
T

82 lines
1.5 KiB
Vue
Raw Normal View History

2020-04-28 12:51:00 +02:00
<template>
2020-04-28 14:51:17 +02:00
<div class="ui-state-button" :class="{'is-disabled': disabled }">
2020-04-28 12:51:00 +02:00
<input ref="input" type="hidden" :value="value" />
<button v-for="item in items" @click="select(item.value)" v-localize="item.label"
type="button" class="ui-state-button-item" :disabled="disabled || item.disabled" :class="{ 'is-active': value === item.value }"></button>
</div>
</template>
<script>
export default {
props: {
disabled: {
type: Boolean,
default: false
},
items: {
type: Array,
default: []
},
value: {
2020-04-30 15:35:09 +02:00
type: [ String, Number ],
2020-04-28 12:51:00 +02:00
default: null
}
},
methods: {
select(value)
{
if (!this.disabled)
{
this.$emit('input', value);
}
}
}
}
</script>
<style>
2020-04-28 12:51:00 +02:00
.ui-state-button
{
2020-06-05 15:46:24 +02:00
display: inline-flex;
2020-04-28 12:51:00 +02:00
}
2020-04-28 14:51:17 +02:00
.ui-state-button.is-disabled button
{
cursor: default;
}
2020-04-28 12:51:00 +02:00
button.ui-state-button-item
{
background: var(--color-input);
2020-05-02 12:20:22 +02:00
padding: 10px 16px;
color: var(--color-text-dim);
}
2020-04-28 12:51:00 +02:00
button.ui-state-button-item + .ui-state-button-item
{
border-left: none;
}
2020-06-05 15:34:13 +02:00
button.ui-state-button-item:first-of-type
{
border-top-left-radius: var(--radius);
border-bottom-left-radius: var(--radius);
}
2020-04-28 12:51:00 +02:00
button.ui-state-button-item:last-child
{
border-top-right-radius: var(--radius);
border-bottom-right-radius: var(--radius);
}
2020-04-28 12:51:00 +02:00
button.ui-state-button-item.is-active
{
color: var(--color-text);
font-weight: bold;
2020-04-28 12:51:00 +02:00
}
</style>