summaryrefslogtreecommitdiff
path: root/day9/task5_vue/src/components/AddNewEntryButton.vue
blob: f22da0fca93520d9b9b7c1983737a6d505026fef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<template>
    <button
            @mouseenter="isHovered = true"
            @mouseleave="isHovered = false"
            @click="showForm">
        <div v-if="isHovered">Add new entry</div>
        <div v-else>+</div>
    </button>
</template>

<script>
    import EditFormBox from "./EditFormBox.vue";

    export default {
        name: "AddNewEntryButton",
        components: {EditFormBox},

        data() {
            return {
                isHovered: false,
            }
        },

        methods: {
            showForm() {
                this.$emit('show-form', {
                    service_id: '', servtype: '', subtype: '',
                    user_id: '', referrer_user_id: '', state: '',
                    creation_date: '', creation_time: '',
                    creation_request_sent_date: '',
                    notified_about_expiration: ''
                });
            }
        }
    }
</script>

<style scoped lang="less">
    @button-radius: 100px;
    @button-hovered-width: 300px;

    button {
        overflow: hidden;
        white-space: nowrap;

        position: fixed;

        padding: 5px;
        border-radius: @button-radius / 2;
        width: @button-radius;
        height: @button-radius;
        border: none;
        background-color: #2871e2;
        color: white;
        font-size: 45px;

        transition-property: width;
        transition-duration: 0.6s;

        bottom: 50px;
        left: 50px;
    }

    button:hover {
        width: @button-hovered-width;
        font-size: 30px;
        background-color: #286bd6;
    }

    button:focus {
        background-color: #2861c3;
    }
</style>