
<template>
  <div v-if="visible" class="fotkipress-modal-window" v-bind:style="{bottom: '20px', right: '50px'}">
    <header>
      <div>
        <span @click="clear()" class="header-button">Clear</span>
        <span @click="close()" class="header-button">Close</span>
      </div>
    </header>

    <div class="modal-window-content">
      <div v-if="files.length === 0" class="file-description">
        <div class="no-files">No files</div>
      </div>

      <div v-for="file in files" class="file-description">
        <div class="name-and-status">
          <div class="file-name">{{file.name}}</div>
          <div class="file-status">{{file.status}}</div>
        </div>
        <div class="uploading-error">{{file.error}}</div>
        <progress :value="file.percent" max="100"></progress>
      </div>
    </div>
  </div>
</template>


<script>
export default {
    props: {
        visible: {
            type: Boolean,
            required: true,
            default: false
        },
        files: {
            type: Array,
            required: true
        },
        clear: {
            type: Function,
            required: true
        },
        close: {
            type: Function,
            required: true
        }
    },

    methods: {
        clearWindow() {
            this.clear();
        },

        closeWindow() {
            this.close();
        }
    }
};
</script>
