header-layout.vue 1.82 KB
<template>
    <section class="header-tools">
        <div
            v-for="(item, index) in items"
            :class="item.enabled ? 'button' : 'button disabled'"
            :key="index"
            @click="onClick(item.key)"
        >
            <div class="img-wrapper" :id="item.key">
                <img :src="item.icon" alt="" />
            </div>
            <span> {{ $t(`${item.key}`) }}</span>
        </div>
    </section>
</template>
<script setup>
// import { storeToRefs } from 'pinia';
import { useCanvasHeaderLayoutStore } from '@/views/stores/header/useCanvasHeaderLayoutStore';

const store = useCanvasHeaderLayoutStore();
const { items } = store;
</script>
<style lang="less">
.header-tools {
    display: flex;
    margin-left: 1px;
    gap: 4px;
    .button {
        all: unset;
        display: flex;
        -webkit-box-align: center;
        align-items: center;
        padding: 8px 8px 6px;
        border-radius: 4px;
        pointer-events: initial;
        cursor: pointer;
        &:hover {
            background-color: rgba(0, 0, 0, 0.08);
        }
        span {
            font-size: 14px;
            font-weight: 550;
            letter-spacing: -0.05px;
            color: rgb(51, 51, 51);
            text-align: center;
            margin-top: 1px;
            margin-left: 4px;
        }
        .img-wrapper {
            display: inline-block;
            overflow: hidden;
            width: 18px;
            height: 18px !important;
        }
        &.disabled {
            overflow: hidden;
            pointer-events: none;
            span {
                color: #b3bac1;
            }
            img {
                transform: translateX(-100%);
                filter: drop-shadow(18px 0 @color-button-disabled) !important;
            }
            cursor: default;
        }
    }
}
</style>