<!-- Used as Button & Heading Control -->
<script setup>
const props = defineProps(["df", "value"]);
</script>

<template>
  <div class="control form-builder-control editable" :data-fieldtype="df.fieldtype">
    <!-- label -->
    <div class="field-controls">
      <h4 v-if="df.fieldtype === 'Heading'">
        <slot name="label" />
      </h4>
      <button v-else class="btn btn-xs btn-default">
        <slot name="label" />
      </button>
      <slot name="actions" />
    </div>

    <!-- description -->
    <div v-if="df.description" class="mt-2 description" v-html="df.description" />
  </div>
</template>

<style lang="scss" scoped>
h4 {
  margin-bottom: 0px;
  font-size: 16px;
  font-weight: 600;
  color: #111827;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background-color: #f3f4f6;
  cursor: pointer;
  font-size: 13px;
  
  &:hover {
    background-color: #e5e7eb;
  }
}

.description {
  font-size: 12px;
  color: #6b7280;
}

.mt-2 {
  margin-top: 0.5rem;
}
</style>
