applications.vue 2.63 KB
<template>
    <section class="applications">
        <div class="fields">
            <span
                :class="item.enabled ? (selecteditem === item.key ? 'item selected' : 'item') : 'item disabled'"
                v-for="item in items"
                :key="item.key"
                @click="onSelect(item.key)"
            >
                <img :src="item.image" />
                <div class="text" v-text="$t(item.key)" />
            </span>
        </div>
    </section>
</template>
<script setup>
import { useApplicationsStore } from '@/views/stores/applications/useApplicationsStore';
import { storeToRefs } from 'pinia';

const store = useApplicationsStore();
const { items, selecteditem } = storeToRefs(store);
const { handleSelect } = store;

const onSelect = (key) => {
    handleSelect(key);
};
</script>
<style lang="less" scope>
.applications {
    display: flex;
    .fields {
        display: flex;
        flex-direction: row;
        -webkit-box-pack: justify;
        flex-wrap: wrap;
        gap: 7px;
        justify-content: flex-start;
        height: 172px;
        .item {
            box-sizing: border-box;
            display: flex;
            cursor: pointer;
            background-color: #ffffff;
            border: 1px solid #cdd1d5;
            border-radius: 8px;
            border-image: initial;
            display: flex;
            flex-direction: column;
            width: 62px;
            img {
                width: 60px;
                height: 50px;
                margin: auto;
                display: block;
            }
            .text {
                margin: 0px;
                font-size: 10px;
                font-weight: 500;
                color: #333333;
                margin: auto;
                font-weight: 600;
                text-align: center;
                white-space: pre-wrap;
            }
            &.selected {
                background-color: @color-button-selected-background;
                border-color: @color-button-main-selected-border;
            }
            &.disabled {
                background-color: @canvas-background-color;
                cursor: not-allowed;
            }
            &:hover {
                background-color: @color-button-hover-background;
            }
        }
    }
}
@media screen and (max-height: 920px) {
    .applications {
        .fields {
            gap: 8px !important;
            .item {
                width: 60px !important;
                img {
                    width: 59px !important;
                    height: 50px !important;
                }
            }
        }
        height: 50vh !important;
    }
}
</style>