Files
baserow/web-frontend/modules/core/components/ButtonFloating.vue
Davide Silvestri 331910f62e fix(database): anchor the floating add row button to the view (#6222)
* fix(database): anchor the floating add row button to the view

Position the + button absolute to the gallery, grid and timeline view
containers instead of fixed to the viewport, so it stays inside the view
when a side panel narrows it.

* chore(storybook): replace fixed with absolute in ButtonFloating story
2026-09-30 16:30:54 +02:00

86 lines
1.8 KiB
Vue

<template>
<button
class="button-floating"
:class="classes"
:disabled="disabled || loading"
v-bind="$attrs"
>
<i v-if="!loading" class="button-floating__icon" :class="icon" />
</button>
</template>
<script>
export default {
props: {
/**
* The type of the button: primary or secondary
*/
size: {
required: false,
type: String,
default: 'regular',
validator: function (value) {
return ['small', 'regular'].includes(value)
},
},
/**
* The type of the button: primary or secondary
*/
type: {
required: false,
type: String,
default: 'primary',
validator: function (value) {
return ['primary', 'secondary'].includes(value)
},
},
/**
* The icon that must be shown inside the button.
*/
icon: {
type: String,
default: '',
},
/**
* Wether the button is loading or not.
*/
loading: {
required: false,
type: Boolean,
default: false,
},
disabled: {
required: false,
type: Boolean,
default: false,
},
active: {
required: false,
type: Boolean,
default: false,
},
position: {
required: false,
type: String,
default: 'relative',
validator: function (value) {
return ['relative', 'absolute'].includes(value)
},
},
},
computed: {
classes() {
const classObj = {
'button-floating--loading': this.loading,
'button-floating--absolute': this.position === 'absolute',
[`button-floating--${this.type}`]: this.type,
[`button-floating--${this.size}`]: this.size,
disabled: this.disabled,
active: this.active,
}
return classObj
},
},
}
</script>