<script>
    import {ref} from "vue";
    import {useScheduleStore} from '../../stores/schedule.js';

    export default {
        name: "Links",
        data: () => ({
            links: ref(),
            fetching: true,
            scheduleStore: useScheduleStore()
        }),
        props: {
            isWide: Boolean
        },
        mounted() {
            this.scheduleStore.getLinks().then(()=>{
                this.links = this.scheduleStore.links;
                this.fetching = false;
            });
        }
    }
</script>

<template>
    <div class="w-100 d-flex justify-center">
        <v-list class="bg-grey-darken-3" :class="isWide ? 'w-66' : 'w-100'">
            <v-skeleton-loader v-if="fetching" type="list-item" class="bg-grey-darken-3 ml-1 mr-3"/>
            <v-list-item v-else class="bg-grey-darken-3 neon-border mt-6 mb-7 ml-7 mr-7" elevation="0" v-for="link in links" :href="link.link"> <!-- style="background-color: #E57373; color: #FFFFFF" -->
                <template v-slot:prepend>
                    <v-avatar class="mt-1 mb-1 ml-5" :image="link.image" rounded="0"></v-avatar>
                </template>
                <v-list-item-title>{{ link.link_name }}</v-list-item-title>
            </v-list-item>
        </v-list>
    </div>
</template>

<style scoped>

</style>
