schlechtenburg/src/components/internal/Block.tsx

49 lines
844 B
TypeScript
Raw Normal View History

2020-05-20 14:21:08 +00:00
import { computed, defineComponent } from '@vue/composition-api';
import './Block.scss';
export default defineComponent({
name: 'sb-block',
props: {
active: { type: Boolean, default: false },
},
setup(props, context) {
const classes = computed(() => ({
'sb-block': true,
'sb-block_active': props.active,
}));
const activate = () => {
if (props.active) {
return;
}
context.emit('activate');
};
return {
classes,
activate,
};
},
render() {
return (
<div
class="sb-block"
tabindex="0"
{...{
on: {
click: this.activate,
},
}}
>
{this.$slots.toolbar}
{this.$slots.default ? this.$slots.default : <div>Your content here</div>}
</div>
);
},
});