<template>
  <div class="quote-card__container" :class="{ 'quote-card__container__editable': editable }">
    <div v-if="editable" class="quote-card__action-buttons">
      <QuoteCardActionButton @click="editQuote">✎</QuoteCardActionButton>
      <QuoteCardActionButton @click="deleteQuote">🗑</QuoteCardActionButton>
    </div>
    <div class="quote__quote">
      {{ quote.quote }}
    </div>
  </div>
</template>

<script setup lang="ts">
import useEngine from '@/composables/useEngine'
import type { Quote } from '@/composables/engine.d'

const props = defineProps<{
  quote: Quote,
  editable?: boolean,
}>()


const editQuote = () => {
  console.warn('editQuote() not yet implemented')
}

const deleteQuote = () => useEngine().deleteQuote(props.quote.id)
</script>

<style lang="scss">
@import '~/assets/css/components';

.quote-card {
  &__container {
    position: relative;
    display: flex;
    align-items: center;
    width: 300px;
    height: 150px;
    margin: 32px;
    padding: 32px;
    background-color: $quote-background-color;
    border: $quote-border;
    border-radius: 0 16px 0 0;
    color: $quote-text-color;

    &__editable {
      cursor: text;

      & .quote__quote {
        cursor: text;
      }
    }
  }

  &__quote {
    font-family: $font-secondary;
    font-weight: bold;
    font-size: 24px;
    text-align: center;
    cursor: default;
  }

  &__action-buttons {
    position: absolute;
    right: -28px;
    top: -24px;
    display: flex;
  }
}
</style>
