measure-modal.vue 2.75 KB
<template>
    <section class="measure">
        <div class="measure-types">
            <span
                :class="selecteditem === item.key ? 'item selected' : 'item'"
                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>
        <span class="button-big" v-text="$t('removemeasure')" @click="onRemove" />
    </section>
</template>
<script setup>
import { useMeasureStore } from '@/views/stores/funtional-toolbar/useMeasureStore';
import { storeToRefs } from 'pinia';

const store = useMeasureStore();
const { items, selecteditem } = storeToRefs(store);
const { setSelectedItem, removeMeasures } = store;

const onSelect = (key) => {
    setSelectedItem(key);
};
const onRemove = () => {
    removeMeasures();
};
</script>
<style lang="less" scoped>
.measure {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 20px;
    .measure-types {
        display: flex;
        flex-direction: row;
        -webkit-box-pack: justify;
        justify-content: space-between;
        .item {
            box-sizing: border-box;
            display: flex;
            cursor: pointer;
            background-color: #ffffff;
            padding: 8px 11px;
            border: 1px solid #cdd1d5;
            border-radius: 8px;
            border-image: initial;
            display: flex;
            flex-direction: column;
            width: 140px;
            img {
                width: 36px;
                height: 36px;
                margin: auto;
                display: block;
            }
            .text {
                width: max-content;
                padding-top: 5px;
                margin: 0px;
                font-size: 14px;
                line-height: 22px;
                font-weight: 500;
                color: #333333;
                margin: auto;
                display: block;
                font-weight: 600;
            }
            &.selected {
                background-color: @color-button-selected-background;
                border-color: @color-button-main-selected-border;
            }
            &:hover {
                background-color: @color-button-hover-background;
            }
        }
    }
    .button-big {
        display: flex;
        width: 100%;
        -webkit-box-pack: center;
        justify-content: center;
        -webkit-box-align: center;
        align-items: center;
        padding: 0px;
        height: 46px;
        border-radius: 8px;
        cursor: pointer;
        margin: 0px;
        font-size: 14px;
        line-height: 20px;
        font-weight: 600;
        margin-top: 12px;
    }
}
</style>