<template>
  <div class="kole-result" :class="'is-' + type">
    <div class="kole-result-icon">{{ iconMap[type] || 'i' }}</div>
    <div class="kole-result-title">{{ title }}</div>
    <div class="kole-result-desc" v-if="desc">{{ desc }}</div>
    <div class="kole-result-actions" v-if="actionText || secondaryText">
      <button v-if="actionText" class="kole-result-btn primary" @click="$emit('action')">{{ actionText }}</button>
      <button v-if="secondaryText" class="kole-result-btn" @click="$emit('secondary')">{{ secondaryText }}</button>
    </div>
    <div class="kole-result-extra" v-if="$slots.extra"><slot name="extra"></slot></div>
  </div>
</template>

<script>
export default {
  name: 'KoleResultVariants',
  props: {
    type: { type: String, default: 'success' },
    title: { type: String, default: '' },
    desc: { type: String, default: '' },
    actionText: { type: String, default: '' },
    secondaryText: { type: String, default: '' }
  },
  data: function () {
    return { iconMap: { success: '✓', error: '✕', warning: '!', info: 'i' } };
  }
};
</script>

<style src="./ResultVariants.css"></style>
