Newer
Older
<script setup lang="ts">
defineProps<{
active?: boolean;
disable?: boolean;
<div
:class="[
'item',
{
disable,
},
]"
>
<div
:class="[
'bg',
{
active,
disableBg: disable,
},
]"
></div>
<slot />
</div>
</template>
<style>
.item {
position: relative;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
.item::before {
content: '';
position: absolute;
width: 100%;
height: 100%;
border-radius: 50%;
top: 0;
left: 0;
z-index: -1;
background-color: v-bind(color);
}
.item:hover > .bg {
opacity: 1;
}
.item:active > .bg {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
transition: all 0.2s ease;
}
.item > .active {
background-color: black !important;
opacity: 1;
}
.active + * {
color: white;
}
.disable {
cursor: auto;
pointer-events: none;
}
.disableBg {
background-color: white !important;